Sei sulla pagina 1di 9

CODE:

#include<iostream>

#include<string.h>

#include<conio.h>

#include<process.h>

#include <stdlib.h>

using namespace std;

class coffee

protected:

string name,ph;

int tab;

public:

coffee():name(" "),ph(" "),tab(0)

{}

virtual void set()

{}

void menu();

};

//definition of function outside the class

void coffee::menu()

//menu of coffee

cout<<"\n*******************COFFEE MENU*****************\n";

cout<<"\n SERIAL NUMBER FLAVOR NAME SIZE PRIZE\n";

1|Page
cout<<" 1. Black Coffee 250ml $1.45\n";

cout<<" 2. Black Coffee 350ml $2.10\n";

cout<<" 3. Black Coffee 450ml $3.10\n";

cout<<" 4. Cappuccino 250ml $2.35\n";

cout<<" 5. Cappuccino 350ml $3.45\n";

cout<<" 6. Cappuccino 450ml $4.10\n";

cout<<" 7. Caffe Latte 250ml $2.95\n";

cout<<" 8. Caffe Latte 350ml $3.65\n";

cout<<" 9. Caffe Latte 450ml $4.20\n";

class customer:public coffee

public:

//personal data of the customer and table number from which the order is placed

void set()

cout<<"\n\nEnter Your Name:";

cin>>name;

cout<<"\nEnter your phone number:";

cin>>ph;

cout<<"\nEnter your table number:";

cin>>tab;

};

class bill:public coffee

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();

};

//this function gets the order from the customer

void bill::set()

string cho;

do

i=1;

START:

cout<<"\nWhat do you want:";

cin>>ch;

if(ch<0||ch>9)

cout<<"\nINVALID CHOICE!!";

3|Page
cout<<"\nhow many cups:";

cin>>c;

calculate();
//calling of function calculate

cout<<"\nDo you want more?";

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<<"\nYour bill is:$"<<bi;

cout<<"\n\nEnter amount:$";

cin>>am;

chng=am-bi;

cout<<"\nYour change is:$"<<chng;

//this function calculates the bill

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()

cout<<" NAME ID PHONE NUMBER ADDRESS\n";

cout<<" Hafsa Khan 1 +923345873984 Rawalpindi\n";

cout<<" Farhan Ahmad 2 +923345877740 Lahore\n";

cout<<" Aleena Khan 3 +923315472891 Peshawar\n";

//main function goes here

int main()

5|Page
employee e;

string f,comment;

coffee *c,c1;

int p,num;

int ch;

cout<<"\t**************************************************";

cout<<"\n\t* WELCOME TO STARBUCKS COFFEE *";

cout<<"\n\t**************************************************";

TOP:

cout<<"\n\nEnter 1 to display Employee's record"<<endl;

cout<<"\nEnter 2 if you are a customer,to place an order:"<<endl;

cin>>ch;

if(ch==1) //if the choice is 1 then it will display


employee's personal record

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

//user's feedback is taken here

cout<<"\n\nENTER YOUR FEEDBACK!!";

cout<<"\n* for poor\n";

cout<<"** for satisfactory\n";

cout<<"*** for good\n";

cout<<"**** for excellent\n";

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=="*")

cout<<"\nHow We Can Improve Our Services?\n";

cin>>comment;

cout<<"\n THANKS:)";

return 0;

7|Page
OUTPUT:

8|Page
9|Page

Potrebbero piacerti anche