Complete the code to produce a compiling and working program. Route 66 Kaffeine Kicks is developing an automated ordering service. The system builds their menu and then asks the user for the drink and the size. It outputs a statement providing the users with the cost of their order.
Example output:
Route 66 Caffeine Kicks
latte
venti
grande
$3.21
$3.95
coffee
venti
grande trenti
$2.89
$3.45 $4.29
mocha
venti
grande
$3.45
$4.29
hot chocolate
mini
venti grande trenti
$2.05
$2.89 $3.45 $4.29
What would you like to order?
mocha
What size?
grande
Your mocha will cost $4.29
#include <iostream>
#include <string>
#include <_______>
using namespace std;
class MenuItem
{
public:
_______( string& name, const vector<string>& sizes, const & prices) :
name_(name), sizes_(sizes), (prices) {}
void Print()
{
cout << name_ << endl;
for(string sz : sizes_)
{
cout << "\t" << sz;
}
cout << endl;
for(double price : prices_)
{
cout << "\t$" << price;
}
cout << endl;
}
string getName() { return name_; }
bool getPrice(const string& size_str,_______ price)
{
bool found = false;
for(unsigned int sz = 0; sz < sizes_._______(); sz++)
{
if(size_str == sizes_._______(sz))
{
price = prices_.at(sz);
found = true;
}
}
return found;
}
private:
const string name_;
vector<string> sizes_;
vector<double> prices_;
};
void PrintMenu(const vector<MenuItem>& menu)
{
cout << "Route 66 Caffeine Kicks\n" << endl;
for(MenuItem item : menu)
{
item.Print();
cout << endl;
}
}
bool PriceLookUp(const vector<MenuItem>& menu, const string& drink_name, const string& drink_size, double& price)
{
bool found = false;
for(unsigned int item = 0; item < menu.size(); item++)
{
if(drink_name == menu.at(item)._______())
{
MenuItem drink = menu.at(item);
if(_______(drink_size, price))
{
found = _______ ;
}
}
}
return found;
}
int main()
{
menu;
MenuItem latte("latte", {"venti", "grande"}, {3.21, 3.95});
menu.(latte);
MenuItem coffee("coffee", {"venti", "grande", "trenti"}, {2.89, 3.45, 4.29});
menu.push_back(coffee);
MenuItem mocha("mocha", {"venti", "grande"}, {3.45, 4.29});
menu.push_back(mocha);
MenuItem coco("hot chocolate", {"mini", "venti", "grande", "trenti"}, {2.05, 2.89, 3.45, 4.29});
menu.push_back();
PrintMenu(menu);
string drink_name, drink_size;
cout << "What would you like to order?" << endl;
cin >> drink_name;
cout << "What size?" << endl;
cin >> drink_size;
double price;
if(PriceLookUp(menu, drink_name, drink_size, price))
{
cout << "Your " << drink_name << " will cost $" << price << endl;
}
return 0;
}Note: The modified part of the code is highlighted in bold and grey.
Screenshot of the code:





Sample Output:

Code to copy:
//Include required header files.
#include <iostream>
#include <string>
#include <vector>
//Use the standard naming convention.
using namespace std;
//Define the class MenuItem.
class MenuItem
{
//Define required public member variables.
public:
MenuItem(string& name, const vector<string>& sizes,
const vector<double>& prices) : name_(name),
sizes_(sizes), prices_(prices) {}
void Print()
{
cout << name_ << endl;
for(string sz : sizes_)
{
cout << "\t" << sz;
}
cout << endl;
for(double price : prices_)
{
cout << "\t$" << price;
}
cout << endl;
}
string getName()
{
return name_;
}
bool getPrice(const string& size_str, double& price)
{
bool found = false;
for(unsigned int sz = 0; sz < sizes_.size(); sz++)
{
if(size_str == sizes_.at(sz))
{
price = prices_.at(sz);
found = true;
}
}
return found;
}
//Declare required private member variables.
private:
const string name_;
vector<string> sizes_;
vector<double> prices_;
};
//Define the method PrintMenu().
void PrintMenu(const vector<MenuItem>& menu)
{
//Display the menu using for each loop over the
//vector of objects of class MenuItem.
cout << "Route 66 Caffeine Kicks\n" << endl;
for(MenuItem item : menu)
{
item.Print();
cout << endl;
}
}
//Define the method PriceLookUp().
bool PriceLookUp(const vector<MenuItem>& menu,
const string& drink_name, const string& drink_size,
double& price)
{
//Declare and initialize required variable.
bool found = false;
//Traverse the vector of objects of class MenuItem
//using a for loop.
for(unsigned int item = 0; item < menu.size();
item++)
{
//Get the current object from the vector.
MenuItem drink = menu.at(item);
//If the current object's drink name is matched
//with the given drink name.
if(drink_name == drink.getName())
{
//If the getPrice() method returns true, the
//set found to true.
if(drink.getPrice(drink_size, price))
{
found = true;
}
}
}
//Return the value of the variable found.
return found;
}
//Start the execution of the main() method.
int main()
{
//Declare required vectors, strings, and double
//variables.
vector<MenuItem> menu;
vector <string> size_of_drink;
vector <double> drink_price;
string drink_name, drink_size;
string drink = "";
double price;
//Fill the vector of drink size and drink prices.
size_of_drink.push_back("venti");
size_of_drink.push_back("grande");
drink_price.push_back(3.21);
drink_price.push_back(3.95);
drink = "latte";
//Pass the required values to the constructor.
MenuItem latte(drink, size_of_drink, drink_price);
//Add the object of MenuItem class to the vector.
menu.push_back(latte);
//Clear the vector of drink size and prices.
size_of_drink.clear();
drink_price.clear();
//Fill the vector of drink size and drink prices.
size_of_drink.push_back("venti");
size_of_drink.push_back("grande");
size_of_drink.push_back("trenti");
drink_price.push_back(2.89);
drink_price.push_back(3.45);
drink_price.push_back(4.29);
drink = "coffee";
//Pass the required values to the constructor.
MenuItem coffee(drink, size_of_drink, drink_price);
//Add the object of MenuItem class to the vector.
menu.push_back(coffee);
//Clear the vector of drink size and prices.
size_of_drink.clear();
drink_price.clear();
//Fill the vector of drink size and drink prices.
size_of_drink.push_back("venti");
size_of_drink.push_back("grande");
drink_price.push_back(3.45);
drink_price.push_back(4.29);
drink = "mocha";
//Pass the required values to the constructor.
MenuItem mocha(drink, size_of_drink, drink_price);
//Add the object of MenuItem class to the vector.
menu.push_back(mocha);
//Clear the vector of drink size and prices.
size_of_drink.clear();
drink_price.clear();
//Fill the vector of drink size and drink prices.
size_of_drink.push_back("mini");
size_of_drink.push_back("venti");
size_of_drink.push_back("grande");
size_of_drink.push_back("trenti");
drink_price.push_back(2.05);
drink_price.push_back(2.89);
drink_price.push_back(3.45);
drink_price.push_back(4.29);
drink = "hot chocolate";
//Pass the required values to the constructor.
MenuItem coco(drink, size_of_drink, drink_price);
//Add the object of MenuItem class to the vector.
menu.push_back(coco);
//Clear the vector of drink size and prices.
size_of_drink.clear();
drink_price.clear();
//Call the function PrintMenu() to display the
//required menu.
PrintMenu(menu);
//Prompt the user to enter the drink name and size.
cout << "What would you like to order?" << endl;
cin >> drink_name;
cout << "What size?" << endl;
cin >> drink_size;
//If the value returned by the function
//PriceLookUp() is true, then display the price of
//the drink selected.
if(PriceLookUp(menu, drink_name, drink_size,
price))
{
cout << "Your " << drink_name << " will cost $";
cout << price << endl;
}
return 0;
}
Complete the code to produce a compiling and working program. Route 66 Kaffeine Kicks is developing...
I need help with this assignment, can someone HELP ? This is the assignment: Online shopping cart (continued) (C++) This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program). (1) Extend the ItemToPurchase class per the following specifications: Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt) Public member functions SetDescription() mutator & GetDescription() accessor (2 pts) PrintItemCost() - Outputs the item name followed by...
THIS IS FOR C++ PROGRAMMING USING VISUAL
STUDIO
THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING
#include "pch.h"
#include
#include
using namespace std;
// Function prototype
void displayMessage(void);
void totalFees(void);
double calculateFees(int);
double calculateFees(int bags) {
return bags * 30.0;
}
void displayMessage(void) {
cout << "This program calculates the total
amount of checked bag fees." << endl;
}
void totalFees() {
double bags = 0;
cout << "Enter the amount of checked bags you
have." << endl;
cout <<...
CODES: main.cpp #include <iostream> #include <string> #include "ShoppingCart.h" using namespace std; char PrintMenu() { char answer; cout << "MENU" << endl; cout << "a - Add item to cart" << endl; cout << "d - Remove item from cart" << endl; cout << "c - Change item quantity" << endl; cout << "i - Output items' descriptions" << endl; cout << "o - Output shopping cart" << endl; cout << "q - Quit" << endl << endl; while (true) {...
#include <iostream> #include <iomanip> #include <vector> #include <string> using namespace std; struct menuItemType { string menuItem; double menuPrice; }; void getData(menuItemType menuList[]); void showMenu(menuItemType menuList[], int x); void printCheck(menuItemType menuList[], int menuOrder[], int x); int main() { const int menuItems = 8; menuItemType menuList[menuItems]; int menuOrder[menuItems] = {0}; int orderChoice = 0; bool ordering = true; int count = 0; getData(menuList); showMenu(menuList, menuItems); while(ordering) { cout << "Enter the number for the item you would\n" << "like to order, or...
Hello, I have some errors in my C++ code when I try to debug it.
I tried to follow the requirements stated below:
Code:
// Linked.h
#ifndef INTLINKEDQUEUE
#define INTLINKEDQUEUE
#include <iostream>
usingnamespace std;
class IntLinkedQueue
{
private: struct Node {
int data;
Node *next;
};
Node *front; // -> first item
Node *rear; // -> last item
Node *p; // traversal position
Node *pp ; // previous position
int size; // number of elements in the queue
public:
IntLinkedQueue();...
4.18 Ch 7 Program: Online shopping cart (continued) (C++) This program extends the earlier "Online shopping cart" program. (solution from previous lab assignment is provided in Canvas). (1) Extend the ItemToPurchase class per the following specifications: Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt) Public member functions SetDescription() mutator & GetDescription() accessor (2 pts) PrintItemCost() - Outputs the item name followed by the quantity, price, and subtotal PrintItemDescription() -...
In C++: Please help me correct this code .... All parts with (FIX ME) #include <algorithm> #include <climits> #include <iostream> #include <string> // atoi #include <time.h> #include "CSVparser.hpp" using namespace std; //============================================================================ // Global definitions visible to all methods and classes //============================================================================ const unsigned int DEFAULT_SIZE = 179; // forward declarations double strToDouble(string str, char ch); // define a structure to hold bid information struct Bid { string bidId; // unique identifier string title; string fund; double amount; Bid() {...