Need help fixing my code!!only modify under TODO!! Food_wastage_tracker_backend.cc #include "food_wastage_tracker_backend.h" #include #include "food_wastage_record.h" #include "food_wastage_report.h" #include "server_utils/rapidjson/document.h"      // rapidjson's DOM-style API #include "server_utils/rapidjson/prettywriter.h"  // for stringify JSON #include "server_utils/rapidjson/rapidjson.h" #include "server_utils/rapidjson/stringbuffer.h"  // wrapper of C stream for prettywriter as output #include "server_utils/rapidjson/writer.h" // Util function to convert a FoodWastageRecord class object into a serialized // JSON object. void SerializeFoodWastageRecordToJSON(     const FoodWastageRecord &record,     rapidjson::Writer *writer) {   writer->StartObject();   writer->String("date_");  // DO NOT MODIFY   std::string date;   // TODO 1. Use the accessor/getter function for date from the   // FoodWastageRecord class object to get the date and store it in the date   // string declared above.   FoodWastageRecord record;   date = record.Date();   writer->String(date.c_str());   writer->String("meal_");  // DO NOT MODIFY   std::string meal;   // TODO 2. Use the accessor/getter function for meal from the   // FoodWastageRecord class object to get the meal and store it in the meal   // string declared above.   meal = record.Meal();   writer->String(meal.c_str());   writer->String("food_name_");  // DO NOT MODIFY   std::string food_name;   // TODO 3. Use the accessor/getter function for food name from the   // FoodWastageRecord class object to get the food name and store it in the   // food_name string declared above.   food_name = record.FoodName();   writer->String(food_name.c_str());   writer->String("qty_in_oz_");  // DO NOT MODIFY   double quantity;   // TODO 4. Use the accessor/getter function for quantity from the   // FoodWastageRecord class object to get the quantity and store it in the   // quantity variable declared above.   quantity = record.QuantityInOz();   writer->Double(quantity);   writer->String("wastage_reason_");  // DO NOT MODIFY   std::string wastage_reason;   // TODO 5. Use the accessor/getter function for wastage reason from the   // FoodWastageRecord class object to get the wastage reason and store it in   // the wastage_reason string declared above.   wastage_reason = record.WastageReason();   writer->String(wastage_reason.c_str());   writer->String("disposal_mechanism_");  // DO NOT MODIFY   std::string disposal_mechanism;   // TODO 6. Use the accessor/getter function for disposal mechanism from the   // FoodWastageRecord class object to get the disposal mechanism and store it   // in the disposal_mechanism string declared above.   disposal_mechanism = record.DisposalMechanism();   writer->String(disposal_mechanism.c_str());   writer->String("cost_");  // DO NOT MODIFY   double cost;   // TODO 7. Use the accessor/getter function for cost from the   // FoodWastageRecord class object to get the cost and store it in the cost   // variable declared above.   cost = record.Cost();   writer->Double(cost);   writer->EndObject();

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Need help fixing my code!!only modify under TODO!!

Food_wastage_tracker_backend.cc

#include "food_wastage_tracker_backend.h"

#include <filesystem>

#include "food_wastage_record.h"
#include "food_wastage_report.h"
#include "server_utils/rapidjson/document.h"      // rapidjson's DOM-style API
#include "server_utils/rapidjson/prettywriter.h"  // for stringify JSON
#include "server_utils/rapidjson/rapidjson.h"
#include "server_utils/rapidjson/stringbuffer.h"  // wrapper of C stream for prettywriter as output
#include "server_utils/rapidjson/writer.h"

// Util function to convert a FoodWastageRecord class object into a serialized
// JSON object.
void SerializeFoodWastageRecordToJSON(
    const FoodWastageRecord &record,
    rapidjson::Writer<rapidjson::StringBuffer> *writer) {
  writer->StartObject();

  writer->String("date_");  // DO NOT MODIFY
  std::string date;
  // TODO 1. Use the accessor/getter function for date from the
  // FoodWastageRecord class object to get the date and store it in the date
  // string declared above.
  FoodWastageRecord record;
  date = record.Date();
  writer->String(date.c_str());

  writer->String("meal_");  // DO NOT MODIFY
  std::string meal;
  // TODO 2. Use the accessor/getter function for meal from the
  // FoodWastageRecord class object to get the meal and store it in the meal
  // string declared above.
  meal = record.Meal();
  writer->String(meal.c_str());

  writer->String("food_name_");  // DO NOT MODIFY
  std::string food_name;
  // TODO 3. Use the accessor/getter function for food name from the
  // FoodWastageRecord class object to get the food name and store it in the
  // food_name string declared above.
  food_name = record.FoodName();
  writer->String(food_name.c_str());

  writer->String("qty_in_oz_");  // DO NOT MODIFY
  double quantity;
  // TODO 4. Use the accessor/getter function for quantity from the
  // FoodWastageRecord class object to get the quantity and store it in the
  // quantity variable declared above.
  quantity = record.QuantityInOz();
  writer->Double(quantity);

  writer->String("wastage_reason_");  // DO NOT MODIFY
  std::string wastage_reason;
  // TODO 5. Use the accessor/getter function for wastage reason from the
  // FoodWastageRecord class object to get the wastage reason and store it in
  // the wastage_reason string declared above.
  wastage_reason = record.WastageReason();
  writer->String(wastage_reason.c_str());

  writer->String("disposal_mechanism_");  // DO NOT MODIFY
  std::string disposal_mechanism;
  // TODO 6. Use the accessor/getter function for disposal mechanism from the
  // FoodWastageRecord class object to get the disposal mechanism and store it
  // in the disposal_mechanism string declared above.
  disposal_mechanism = record.DisposalMechanism();
  writer->String(disposal_mechanism.c_str());

  writer->String("cost_");  // DO NOT MODIFY
  double cost;
  // TODO 7. Use the accessor/getter function for cost from the
  // FoodWastageRecord class object to get the cost and store it in the cost
  // variable declared above.
  cost = record.Cost();
  writer->Double(cost);

  writer->EndObject();
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Study of Characters
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education