write a C++ program that sells candy and drinks using the enumeration type. You must use the following within your program: enum sizes {SMALL, MEDIUM, LARGE, JUMBO}; sizes Candysize, drinkSize; You should create a menu that asks the user to choose what size of drink they want and to choose what size of popcorn they want. Then I have to print out the total cost of the drink and popcorn. The Prices:
Candy Soda
Small 1.25 1.50
Medium 2.25 2.50
Large 3.50 3.75
Jumbo 4.25 4.50
Please find the required solution:
#include<iostream>
#include<string>
using namespace std;
enum sizes {SMALL, MEDIUM, LARGE, JUMBO};
sizes Candysize, drinkSize;
void initialize(int i,sizes select);
double getCanndyBill(sizes);
double getDrinkBill(sizes);
int main()
{
int i,cSize,dSize;
double total=0;
do
{
cout<<"----Menu----"<<endl;
cout<<"Size\tCandy\tSoda"<<endl;
cout<<"1.SMALL\t1.25\t1.50"<<endl;
cout<<"2.MEDIUM
2.25\t2.50"<<endl;
cout<<"3.LARGE\t3.50\t3.75"<<endl;
cout<<"4.JUMBO\t4.25\t4.50"<<endl;
cout<<"Select size of
candy:";
cin>>cSize;
initialize(cSize,Candysize);
cout<<"Select size of
drink:";
cin>>dSize;
initialize(dSize,drinkSize);
total+=getCanndyBill(Candysize);
total+=getDrinkBill(drinkSize);
cout<<"do you want to
continue to order 1 for yes others exit:";
cin>>i;
}while(i==1);
cout<<"\nTotal
Price"<<total<<endl;
}
void initialize(int i,sizes select)
{
switch(i)
{
case 1:select=SMALL;
break;
case 2:select=MEDIUM;
break;
case 3:select=LARGE;
break;
case 4:select=JUMBO;
break;
}
}
double getCanndyBill(sizes select)
{
switch(select)
{
case SMALL:return 1.25;
case MEDIUM:return 2.25;
case LARGE:return 3.50;
case JUMBO:return 4.25;
}
}
double getDrinkBill(sizes select)
{
switch(select)
{
case SMALL:return 1.50;
case MEDIUM:return 2.50;
case LARGE:return 3.75;
case JUMBO:return 4.50;
}
}
Sample screenshot:
write a C++ program that sells candy and drinks using the enumeration type. You must use...
Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders that come in. This program will require multiple classes. Summary class, customer class, order class and the driver class. Summary class This class will keep track of the cost of the order and output a summary, which includes the total for the order. The methods in this class are static. There are no instance variables, and instead uses an Order object that is passed...
Using C#, write a program. You are a coffee and tea shop. You will allow customers to enter their orders. You sell coffee and tea in three sizes, small coffee for $1.00, medium for $1.20, and large for $1.40. Tea is $1.20, $1.40, and $1.60. You will let ask the user what they want, size, ask if they want to order anything else, continue taking their order. At the end show them how much they owe. If they order more...