Question: #include #include using namespace std; class Order { public: void SetFoodAndQuantity(string newFood, int newQuantity); int GetQuantity() const; private: string food; int quantity; }; void Order::SetFoodAndQuantity(string

 #include #include using namespace std; class Order { public: void SetFoodAndQuantity(string

#include #include using namespace std;

class Order { public: void SetFoodAndQuantity(string newFood, int newQuantity); int GetQuantity() const; private: string food; int quantity; };

void Order::SetFoodAndQuantity(string newFood, int newQuantity) { food = newFood; quantity = newQuantity; }

int Order::GetQuantity() const { return quantity; }

class Ledger { public: void InputOrders(); int FindHighestOrderQuantity(); private: vector orderList; };

void Ledger::InputOrders() { int orderCount; unsigned int i; Order currOrder; string currFood; int currQuantity; cin >> orderCount; for (i = 0; i > currFood; cin >> currQuantity; currOrder.SetFoodAndQuantity(currFood, currQuantity); orderList.push_back(currOrder); } }

// ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++. DO NOT MODIFY THE REST OF THE CODE. (THANK YOU!)

int main() { Ledger ledger; ledger.InputOrders(); cout The program first reads integer orderCount from input, representing the number of pairs of inputs to be read. Each pair has a string and an integer. One Order object is created for each pair and added to vector orderList. Write the FindHighestOrderQuantity() function in the Ledger class to return the highest quantity of all the Order objects. Ex: If the input is: 4 melon 9 sausage 27 tomato 4 mushroom 3 then the output is: Highest order quantity: 27 Note: The vector has at least one element

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!