Question
C++ I need to add a new class to my program down below. This new class will have the structs inside of it and now
C++ I need to add a new class to my program down below. This new class will have the structs inside of it and now kinda do inventory check after an order is placed. Its passed to a receive() method in the new class. Then this will call a calcRemainproduct() to determine if there enough product to complete the order. Subtract the amount of each product from their respective amounts. If there not enough it returns a message that it can't complete order and which product is low. Then calculates the remaining amounts and compares the low amount threshold ( threshold enough to produce 4 cups). If a product is low it sends a low product warning. The manager then can refill this towards the end of the code with the switch options. The final part is producing the order, giving a return message that the order is ready or if there wasn't enough that it can't be filled due to low product. The amounts to be used is Coffee: 0.25 for each strength level, .5 per size, 2 for creamer (if selected), 1 for each sugar used.
#include
} int main() { customer c; struct customer arr[10]; //order number char ch1,ch2,input; //char input; int i,option, answer; int flag = 0;
do{ do { cout<<" Main Menu. "< cout<<"What coffee would you like?"<<" Columbian=1, FrenchRoast=2, ItalianBlend=3, House=4"< //writing out to the file fstream infile("menu.dat", ios::out | ios::app); infile<< "OrderNumber:" << c.order << " CoffeeName:" << c.rdata.coffeeName << " Strength" << c.rdata.strength << " Size: " << c.rdata.size << " SugarAmount: " << c.rdata.sugar << endl; calcPrice(c); infile<< "Cream: " << c.rdata.creamer << " Cost: $ " << c.rdata.price << endl; infile.close(); cout<<"Back to Main menu?"< //if user selects No in Main Menu if(input == 'N'||input == 'n') { cout<<"[1]View an order " <<"[2] View Total Profit "; cin>>answer; switch(answer) { case 1: cout<<"Enter a order number"; cin>>option; for(i=0;i<10;i++){ //display option if(arr[10].order != option) { flag = 1; cout<<"Here is your order:"< } case 2: char filename[] = "menu.dat"; ifstream infile(filename); string line; double total_price = 0.0; double amount = 0.0; cout << "Calculating total profit"; while(getline(infile, line, ' ')) { size_t found = line.find('$'); //check line containing $ if(found !=string::npos) { stringstream ss(line.substr(1+found)); //grab the amound ss>>amount; //convert string to dollar total_price+=amount; //add the dollar to running total } } infile.close(); cout << " Total profit: " << total_price << endl; break; } } reorder code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started