Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
#include<iostream>
#include<string.h>
#include<conio.h>
#include<process.h>
#include <stdlib.h>
class coffee
protected:
string name,ph;
int tab;
public:
{}
{}
void menu();
};
void coffee::menu()
//menu of coffee
cout<<"\n*******************COFFEE MENU*****************\n";
1|Page
cout<<" 1. Black Coffee 250ml $1.45\n";
public:
//personal data of the customer and table number from which the order is placed
void set()
cin>>name;
cin>>ph;
cin>>tab;
};
2|Page
{
protected:
int i,n,am,ch,c;
float chng,bi;
float arr[9]={1.45,2.10,3.10,2.35,3.45,4.10,2.95,3.65,4.20};
//array is initialized by the prize details of each coffee flavor and size
public:
bill():i(0),n(0),am(0),ch(0),c(0),chng(0),bi(0)
{}
void calculate();
void set();
};
void bill::set()
string cho;
do
i=1;
START:
cin>>ch;
if(ch<0||ch>9)
cout<<"\nINVALID CHOICE!!";
3|Page
cout<<"\nhow many cups:";
cin>>c;
calculate();
//calling of function calculate
cin>>cho;
if(cho=="Yes")
goto START;
//if the customer needs another flavor then control goes to the START label
calculate();
i++;
while(cho!="no");
//if the choice is "no",then it simply calculates the bill
system("cls");
cout<<"\n\nEnter amount:$";
cin>>am;
chng=am-bi;
void bill::calculate()
4|Page
{
for(n=1;n<=9;n++)
if(n==ch)
bi=bi+c*arr[n-1];
//this class contains the personal data of the employees working in the shop
class employee
public:
void employee_record();
};
void employee::employee_record()
int main()
5|Page
employee e;
string f,comment;
coffee *c,c1;
int p,num;
int ch;
cout<<"\t**************************************************";
cout<<"\n\t**************************************************";
TOP:
cin>>ch;
e.employee_record();
goto TOP;
else if(ch==2)
//if the choice is 2 then it will go to all functions required by a customer
system("cls");
customer m;
c=&m;
c->set();
//it calls the function whish takes the personal data of the customer and table number
6|Page
system("cls");
c1.menu();
//this function displays the menu
bill b;
c=&b;
c->set();
//it calls the function whish takes the order
b.calculate();
//it displays the result
cin>>f;
/*if the choice is "*" which means poor,then the user will give some comments that will be taken
to improve our services*/
if(f=="*")
cin>>comment;
cout<<"\n THANKS:)";
return 0;
7|Page
OUTPUT:
8|Page
9|Page