Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, we are trying to make a coffee machine and finally there is a part we need. At the end of the day, list of

Hello, we are trying to make a coffee machine and finally there is a part we need. At the end of the day, list of coffee sold, money made, and summary of the machine state. We couldn't figure out how to write this part. I will be glad if you help me.

#include #include using namespace std;

int main() { int choice; cout<< "Hello customer :) "; cout<<" What would you like to drink today ?"; string menu[]= {"Espresso","Double Espresso","Cappuccino","Americano","Latte","Turkish Coffee", "Macchiato","Mocha","White Mocha" ,"Nescafe Classic","Nescafe Chocolate","Nescafe Vanilla","Hot Chocolate","Frappe","Marocchino"}; float menu_price[]={1.5, 2, 3, 1.5, 2.5, 3.5, 2.5, 3.5, 5, 0.50, 0.75, 0.75, 3, 5, 6.75}; cout<<" Enter 1 for Espresso"; cout<<" Enter 2 for Double Espresso"; cout<<" Enter 3 for Cappuccino"; cout<<" Enter 4 for Americano"; cout<<" Enter 5 for Latte"; cout<<" Enter 6 for Turkish Coffee"; cout<<" Enter 7 for Macchiato"; cout<<" Enter 8 for Mocha"; cout<<" Enter 9 for White Mocha"; cout<<" Enter 10 for Nescafe Classic"; cout<<" Enter 11 for Nescafe Chocolate"; cout<<" Enter 12 for Nescafe Vanilla"; cout<<" Enter 13 for Hot Chocolate"; cout<<" Enter 14 for Frappe"; cout<<" Enter 15 for Marocchino"; float bill= 0; do{ cout<<" Whatever you want to drink, press that number: "; cin>>choice; cout<<" Press -1 for pay/quit"; if(choice == -1){ break; }else if(choice == 14){ cout << " Sorry we don't have Frappe. Do you want drink somethink else?: "; cin>>choice; break; }else if(choice == 12){ cout << " Sorry we don't have Nescafe Vanilla. Do you want drink somethink else?: "; cin>>choice; break; }else if(choice == 7){ cout << " Sorry we don't have Macchiato. Do you want drink somethink else?: "; cin>>choice; break; } cout<<" You chose "<< menu[choice-1]; cout<<" it Costs $"<< menu_price[choice-1]; bill += menu_price[choice-1]; cout<<" So far you owe $"<< bill; }while(true);

while(true){ cout<<" Enter payment in Domination of 1,5,10, or 20 bills : "; int payment; cin>>payment; bill -= payment; if(bill == 0){ cout<<" All total"; break; } else if(bill < 0){ cout<<" Here's your change $"<< -1*bill; break; } else{ cout<<" You gotta give a litte more $"<< bill; }

}

return 0; }

 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions

Question

Use a three-step process to develop effective business messages.

Answered: 1 week ago