In: Computer Science
PROGRAM
#include<iostream>
#include<iostream>
#include<conio.h>
using namespace std;
void menuitem();
void totalbillamount();
int main() //USING TWO FUNCTION FOR MAIN MENU//
{
menuitem(); //DISPALY MENU ITEMS//
totalbillamount();// CALCULATE TOTAL BILL//
getch();
return 0;
}
void menuitem()
{
cout<<"----------------------MENU------------------"<<endl;
cout<<"Water bottles Samll
(s)….……………..…..1.10"<<endl;
cout<<"Large (L)……………………..2.10"<<endl;
cout<<"Juice"<<endl;
cout<<"8 OZ…………………….……..1.75"<<endl;
cout<<"10 OZ………………………….2.20"<<endl;
cout<<"Soda………….…………………….1.00"<<endl;
}
void totalbillamount()
{
int quantity;
char type,type1;
double charge,charge1,charge2,totalbill;
cout<<"How many water bottles?"<<endl;
cin>>quantity;
cout<<"What size(S/L)"<<endl;
cin>>type;
switch(type) ///USING SWITCH FUNCTION TO FIND SAMLL OR LARGE BOTTLE
ABD CALCULATE//
{
case 'S':
charge = quantity * 1.10;
cout<<"Total Charge: "<<charge<<endl;
break;
case 'L':
charge = quantity * 2.10;
cout<<"Total Charge: "<<charge<<endl;
break;
default:
cout<<"You entered invalid type!";
}
cout<<"How many juices?"<<endl;
cin>>quantity;
cout<<"What size(8/10 OZ)[Type E/T]?"<<endl;
//E=8OZ,T=10OZ//
cin>>type1;
switch(type1)
{
case 'E':
charge1 = quantity * 1.75;
cout<<"Total Charge: "<<charge<<endl;
break;
case 'T':
charge1 = quantity * 2.20;
cout<<"Total Charge: "<<charge1<<endl;
break;
default:
cout<<"You entered invalid type!";
}
cout<<"How many sodas?"<<endl;
cin>>quantity;
charge2 = quantity * 1;
totalbill = charge+charge1+charge2;
cout<<"Total bill
amount:"<<totalbill<<endl;
cout<<"Thank you";
}
OUTPUT:
----------------------MENU------------------
Water bottles Samll (s)….……………..…..1.10
Large (L)……………………..2.10
Juice
8 OZ…………………….……..1.75
10 OZ………………………….2.20
Soda………….…………………….1.00
How many water bottles?
2
What size(S/L)
L
Total Charge: 4.2
How many juices?
3
What size(8/10 OZ)[Type E/T]?
T
Total Charge: 6.6
How many sodas?
2
Total bill amount:12.8
COMPILED PROGRAM.
HI SORRY FOR THE DELAY
Already i given the executed output.From my side it was working.pls find the snap .