0% found this document useful (0 votes)
41 views9 pages

DSL Pizza

The document contains code for a pizza ordering and payment system. It defines a Pizza class with methods to accept orders, make payments, and view pending orders. The main function uses a do-while loop to display a menu allowing the user to place new orders, make payments on existing orders, or view currently pending orders until the user exits the program.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views9 pages

DSL Pizza

The document contains code for a pizza ordering and payment system. It defines a Pizza class with methods to accept orders, make payments, and view pending orders. The main function uses a do-while loop to display a menu allowing the user to place new orders, make payments on existing orders, or view currently pending orders until the user exits the program.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Input

#include <iostream>

using namespace std;

#define size 5

class pizza

int porder[size];

int front,rear;

public:

pizza()

front=rear=-1;

int qfull()

if((front==0)&&(rear==(size-1))||(front==(rear+1)%size))

return 1;

else

return 0;

int qempty()

if(front==-1)

return 1;

else

return 0;

int accept_order(int);

void make_payment(int);
void order_in_queue();

};

int pizza::accept_order(int item)

int n;

int k;

int price;

if(qfull())

cout<<"\nVery Sorry !!!! No more orders....\n";

else

if(front==-1)

front=rear=0;

else

rear=(rear+1)%size;

porder[rear]=item;

cout<<"\nNo. of pizza's you want ?";

cin>>n;

k = item;

if(k == 1)

    price = 100;

else if(k == 2)

    price =120;
}

else if(k == 3)

    price =150;

else

    price = 200;

n=n*price;

return n;

void pizza::make_payment(int n)

int item;

char ans;

if(qempty())

cout<<"\nSorry !!! order is not there...\n";

else

cout<<"\nDeliverd orders as follows...\n";

item=porder[front];

if(front==rear)

front=rear=-1;

else

front=(front+1)%size;
}

cout<<"\t"<<item;

cout<<"\nTotal amount to pay : "<<n;

cout<<"\nThank you visit Again....\n";

void pizza::order_in_queue()

int temp;

if(qempty())

cout<<"\nSorry !! There is no pending order...\n";

else

temp=front;

cout<<"\nPending Order as follows..\n";

while(temp!=rear)

cout<<"\t"<<porder[temp];

temp=(temp+1)%size;

cout<<"\t"<<porder[temp];

int main()

pizza p1;

int ch,k,n;

do
{

cout<<"\n______________Welcome To Pizza Parlor __________________\n";

cout << "\n1.Accept order\n2.Make_payment\n3.Pending Orders\nEnter u r choice: ";

cin>>ch;

switch(ch)

case 1:cout<<"\nWhich Pizza do u like most....\n";

cout<<"\n1.Margarita plain cheese Pizza\n2.Chiken peri peri Pizza\n3.Cheeze burst Pizza\n4.chicken


Dominator Pizza";

cout<<"\nPlease enter u r order: ";

cin>>k;

n=p1.accept_order(k);

break;

case 2:

p1.make_payment(n);

break;

case 3:cout<<"\n Following orders are in queue to deliver....as follows..\n";

p1.order_in_queue();

break;

}while(ch!=4);

return 0;

Output
______________Welcome To Pizza Parlor __________________

1.Accept order

2.Make_payment
3.Pending Orders

Enter u r choice: 1

Which Pizza do u like most....

1.Margarita plain cheese Pizza

2.Chiken peri peri Pizza

3.Cheeze burst Pizza

4.chicken Dominator Pizza

Please enter u r order: 4

No. of pizza's you want ?2

______________Welcome To Pizza Parlor __________________

1.Accept order

2.Make_payment

3.Pending Orders

Enter u r choice: 1

Which Pizza do u like most....

1.Margarita plain cheese Pizza

2.Chiken peri peri Pizza

3.Cheeze burst Pizza

4.chicken Dominator Pizza

Please enter u r order: 1

No. of pizza's you want ?3

______________Welcome To Pizza Parlor __________________


1.Accept order

2.Make_payment

3.Pending Orders

Enter u r choice: 1

Which Pizza do u like most....

1.Margarita plain cheese Pizza

2.Chiken peri peri Pizza

3.Cheeze burst Pizza

4.chicken Dominator Pizza

Please enter u r order: 2

No. of pizza's you want ?2

______________Welcome To Pizza Parlor __________________

1.Accept order

2.Make_payment

3.Pending Orders

Enter u r choice: 1

Which Pizza do u like most....

1.Margarita plain cheese Pizza

2.Chiken peri peri Pizza

3.Cheeze burst Pizza

4.chicken Dominator Pizza

Please enter u r order: 4


No. of pizza's you want ?2

______________Welcome To Pizza Parlor __________________

1.Accept order

2.Make_payment

3.Pending Orders

Enter u r choice: 3

Following orders are in queue to deliver....as follows..

Pending Order as follows..

4 1 2 4

______________Welcome To Pizza Parlor __________________

1.Accept order

2.Make_payment

3.Pending Orders

Enter u r choice: 2

Deliverd orders as follows...

Total amount to pay : 400

Thank you visit Again....

______________Welcome To Pizza Parlor __________________

1.Accept order

2.Make_payment

3.Pending Orders

Enter u r choice: 3
Following orders are in queue to deliver....as follows..

Pending Order as follows..

1 2 4

______________Welcome To Pizza Parlor __________________

1.Accept order

2.Make_payment

3.Pending Orders

Enter u r choice: 2

Deliverd orders as follows...

Total amount to pay : 300

Thank you visit Again....

You might also like