Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.28 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<cmath>
  4. using namespace std;
  5.  
  6. //user-defined functions
  7. void printmessage()
  8. {
  9.     //opening
  10.     cout<< "\t\t\t\t******* WELCOME TO AN'S GORGEOUS CAFE ******"<<endl;
  11.     cout<<"\n";
  12.     cout<<"\n";
  13.  
  14. }
  15. int main()
  16.  
  17. {
  18.     //variable declaration
  19.     char name[10], pizza1[]="Chicken Aloha" ,pizza2[]="Prawn Sensation" ,pizza3[]="Flamming Tuna" ,pizza4[]="Vegie Pasta"; //array
  20.     char dessert1[]="Blueberry Cheesecake",dessert2[]="Chocolate Lava Cake",dessert3[]="Almond Brownies"; //array
  21.     char drink1[]="Mango", drink2[]="Coke", drink3[]="Ice Lemon Tea", drink4[]="Milo", gotostart ; //array
  22.     int homeno[4];
  23.     int choice, pchoice,pchoice1, quantity;
  24.     double price;
  25.     static int totalSales=0;
  26.     int phone[11];
  27.  
  28.     printmessage();
  29.     cout<< "Please enter your details: - " << endl;
  30.     cout<<"Name: ";
  31.     cin.getline (name,10);
  32.     cout<< "\nHome no: " ;
  33.     cin>>homeno[4];
  34.     cout<< "\nPhone Number: ";
  35.     cin>>phone[11];
  36.  
  37.     beginning:
  38.     system("CLS");
  39.     cout<<"\nHello "<<name<< "!"<<"\n\nWhat would you like to order?\n\n";
  40.  
  41.     cout<<"\t\t\t\t\t  --------MENU--------\n\n";
  42.  
  43.     cout<<setw(50)<<"1) Pizza\n";
  44.     cout<<setw(52)<<"2) Dessert\n";
  45.     cout<<setw(51)<<"3) Drink\n\n";
  46.     cout<<"\nPlease Enter your Choice: ";
  47.     cin>> choice;
  48.  
  49.     if(choice==1)
  50.      {
  51.         cout<< setw(44) << "1) "<<pizza1<<"\n";
  52.         cout<< setw(44) << "2) "<<pizza2<<"\n";
  53.         cout<< setw(44) << "3) "<<pizza3<<"\n";
  54.         cout<< setw(44) << "4) "<<pizza4<<"\n";
  55.        
  56.         do{
  57.             cout<<"\nPlease Enter which Flavour would you like to have?:";
  58.             cin>>pchoice;
  59.         }while(pchoice!=1 && pchoice!=2 && pchoice!=3 && pchoice!=4); //Will keep looping if User key in invalid input >4
  60.        
  61.        
  62.         if(pchoice>=1 && pchoice<=5)
  63.         {
  64.             cout<< "\n" << setw(60) <<"1) Small RM: 15.90\n"<< setw(61) <<"2) Regular RM:32.90\n"<<setw(60) <<"3) Large RM: 44.90\n";
  65.             cout<< "\nChoose Size Please:";
  66.             cin>>pchoice1;
  67.             if(pchoice1>=1 && pchoice1<=3)
  68.             cout<<"\nPlease Enter Quantity: ";
  69.             cin>>quantity;
  70.             switch(pchoice1)
  71.             {
  72.             case 1: price = 15.90*quantity;
  73.             break;
  74.  
  75.             case 2: price = 32.90*quantity;
  76.             break;
  77.  
  78.             case 3: price = 44.90*quantity;
  79.             break;
  80.  
  81.  
  82.             }
  83.  
  84.             cout << pizza1 ;
  85.             system("CLS");
  86.             switch (pchoice1)
  87.  
  88.  
  89.             {
  90.              case 1:
  91.              cout<<"\t\t\t--------Your Order---------\n";
  92.              cout<<""<<quantity<<" "<<pizza1;
  93.              cout<<"\nYour Total Price is"<< " " << "RM " << price<<"\nYour Order Will be delivered in 40 Minutes";
  94.              break;
  95.              case 2:
  96.              cout<<"\t\t--------Your Order---------\n";
  97.              cout<<""<<quantity<<"  "<<pizza2;
  98.              cout<<"\nYour Total Price is "<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  99.              break;
  100.              case 3:
  101.              cout<<"\t\t--------Your Order---------\n";
  102.              cout<<""<<quantity<<" "<<pizza3;
  103.              cout<<"\nYour Total Price is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  104.              break;
  105.              case 4:
  106.              cout<<"\t\t--------Your Order---------\n";
  107.              cout<<""<<quantity<<" "<<pizza4;
  108.              cout<<"\nYour Total Price is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  109.              break;
  110.  
  111.             }
  112.             cout<<"\nWould you like to order anything else? Y / N:";
  113.             cin>>gotostart;
  114.             if(gotostart=='Y' || gotostart=='y')
  115.             {
  116.               goto beginning;
  117.               //return 0;
  118.             }
  119.  
  120.  
  121.  
  122.         }
  123.  
  124.      }
  125.  
  126.  
  127.     else if(choice==2)
  128.      {
  129.         cout<<setw(44)<<"1) "<<dessert1<<" RM: 12.80"<<"\n";
  130.         cout<<setw(44)<<"2) "<<dessert2<<" RM: 10.80"<<"\n";
  131.         cout<<setw(44)<<"3) "<<dessert3<<" RM: 9.80"<<"\n";
  132.         cout<<"\nPlease Enter which Dessert you would like to have?:";
  133.         cin>>pchoice1;
  134.         if(pchoice1>=1 && pchoice1<=3)
  135.         {
  136.             cout<<"\nPlease Enter Quantity: ";
  137.             cin>>quantity;
  138.             switch(pchoice1)
  139.             {
  140.             case 1: price = 12.80*quantity;
  141.             break;
  142.  
  143.             case 2: price = 10.80*quantity;
  144.             break;
  145.  
  146.             case 3: price = 9.80*quantity;
  147.             break;
  148.  
  149.             }
  150.             system("CLS");
  151.             switch (pchoice1)
  152.             {
  153.              case 1:
  154.              cout<<"\t\t--------Your Order---------\n";
  155.              cout<<""<<quantity<<" "<<dessert1;
  156.              cout<<"\nYour Total Price is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  157.              break;
  158.              case 2:
  159.              cout<<"\t\t--------Your Order---------\n";
  160.              cout<<""<<quantity<<"  "<<dessert2;
  161.              cout<<"\nYour Total Price is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  162.              break;
  163.              case 3:
  164.              cout<<"\t\t--------Your Order---------\n";
  165.              cout<<""<<quantity<<" "<<dessert3;
  166.              cout<<"\nYour Total Price is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  167.              break;
  168.  
  169.  
  170.             }
  171.             cout<<"\nWould you like to order anything else? Y / N:";
  172.             cin>>gotostart;
  173.             if(gotostart=='Y' || gotostart=='y')
  174.             {
  175.               goto beginning;
  176.               //return 0;
  177.             }
  178.         }
  179.     }
  180.  
  181.  
  182.     else if(choice==3)
  183.      {
  184.         cout<<setw(44)<<"1) "<<drink1<<" RM:3.00"<<"\n";
  185.         cout<<setw(44)<<"2) "<<drink2<<" RM:2.00"<<"\n";
  186.         cout<<setw(44)<<"3) "<<drink3<<" RM:1.50"<<"\n";
  187.         cout<<setw(44)<<"4) "<<drink4<<" RM:2.50"<<"\n";
  188.         cout<<"\nPlease Enter which Drinks you would like to have?:";
  189.         cin>>pchoice1;
  190.         if(pchoice1>=1 && pchoice1<=4)
  191.         {
  192.             cout<<"\nPlease Enter Quantity: ";
  193.             cin>>quantity;
  194.             switch(pchoice1)
  195.             {
  196.             case 1: price = 3.00*quantity;
  197.             break;
  198.  
  199.             case 2: price = 2.00*quantity;
  200.             break;
  201.  
  202.             case 3: price = 1.50*quantity;
  203.             break;
  204.  
  205.             case 4: price = 2.50*quantity;
  206.             break;
  207.  
  208.             }
  209.             system("CLS");
  210.             switch (pchoice1)
  211.             {
  212.              case 1:
  213.              cout<<"\t\t--------Your Order---------\n";
  214.              cout<<""<<quantity<<" "<<drink1;
  215.              cout<<"\nYour Total Price is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  216.              break;
  217.              case 2:
  218.              cout<<"\t\t--------Your Order---------\n";
  219.              cout<<""<<quantity<<"  "<<drink2;
  220.              cout<<"\nYour Total Price is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  221.              break;
  222.              case 3:
  223.              cout<<"\t\t--------Your Order---------\n";
  224.              cout<<""<<quantity<<" "<<drink3;
  225.              cout<<"\nYour Total Price is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  226.              break;
  227.              case 4:
  228.              cout<<"\t\t--------Your Order---------\n";
  229.              cout<<""<<quantity<<" "<<drink4;
  230.              cout<<"\nYour Total Bill is"<< " " << "RM " <<price<<"\nYour Order Will be delivered in 40 Minutes";
  231.              break;
  232.  
  233.  
  234.             }
  235.             cout<<"\nWould you like to order anything else? Y / N:";
  236.             cin>>gotostart;
  237.             if(gotostart=='Y' || gotostart=='y')
  238.             {
  239.               goto beginning;
  240.               //return 0;
  241.  
  242.             }
  243.         }
  244.  
  245.             //Price = pchoice1 * pchoice1;
  246.             //cout<<"Your total price is: ";
  247.             //cout<<"\nThank you For Ordering From AN's Gourgeous Cafe\n";
  248.     }
  249.  
  250.     else
  251.     {
  252.             system("CLS");
  253.             cout<<"Please Select Right Option: \n";
  254.             cout<<"Would You like to Start the program again? Y / N: " ;
  255.             cin>>gotostart;
  256.  
  257.             if(gotostart=='Y' || gotostart=='y')
  258.             {
  259.                   goto beginning;
  260.               //return 0;
  261.             }
  262.     }
  263.     totalSales=totalSales+price;
  264.     void showSales() ;
  265.  
  266.  
  267.  
  268.  
  269.     //closing
  270.     cout<<"\n..............................................................";
  271.     cout<<"\n";
  272.     cout<<"\n";
  273.     cout<<"Thank you For Ordering From AN's Gourgeous Cafe\n";
  274.     cout<<"We promise for the best services";
  275.     cout<<"\n\t PLEASE DO COME AGAIN\n\n\n"<<endl;
  276.     system("pause");
  277.     return 0;
  278. }
  279. //  void showSales()
  280. //{
  281.   //    cout<< "Total sales: " << endl;
  282.   //    cout<< totalSales << endl << endl;
  283. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement