hello could you help me to modify my code below 1.  Round the total sum of the order to the nearest 5 sen. refer https://www.bnm.gov.my/misc/-/asset_publisher/2BOPbOBfILtL/content/about-the-rounding-mechanism   #include using namespace std; void menu() {     cout << "******Welcome to the Farhan's Restaurant******" << endl;      cout<<"_________________________________________________"<= 65 && charASCII <= 90) || (charASCII >= 97 && charASCII <= 122) || charASCII == 32)             {                 //do nothing             }             else             {                 invalid = true;             }         }         if (!invalid)             break;         cout << "Invalid Name try again!!\n";     }     cout<<"Please enter your phone number :";     cin>>phone; float jum; string promo; int n; int qty[7]; int no[7]; long price[7],tot[4]; string name[7]; float change,pay,discount; menu(); cout<<""<>n; if(n>0 && n<=7) //loop for menus {     for(int i=0; i>pay;     cout<<"Do you have a promo code?"<>promo;      change=pay-jum;     cout<<"________________________________"<

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

hello could you help me to modify my code below

1.  Round the total sum of the order to the nearest 5 sen. refer https://www.bnm.gov.my/misc/-/asset_publisher/2BOPbOBfILtL/content/about-the-rounding-mechanism

 

#include <iostream>

using namespace std;

void menu()
{
    cout << "******Welcome to the Farhan's Restaurant******" << endl;
     cout<<"_________________________________________________"<<endl;
    cout<<"No.         Menu             Price"<<endl;
    cout<<"1. Cheese Burger              RM  8"<<endl;
    cout<<"2. Chicken Wings(6 pieces)    RM 10"<<endl;
    cout<<"3. 12\" Pepperoni Pizza        RM 20"<<endl;
    cout<<"4. Fries                      RM  5"<<endl;
    cout<<"5. Onion Rings                RM  6"<<endl;
    cout<<"6. Pepsi                      RM  2"<<endl;
    cout<<"7. Mineral Water              RM  3"<<endl;

}

 main()
{
    string phone; //we use string so that the 0 value can be displayed
    string Name;
      while (1)
    {
        cout << "Please Enter the customer's Name:";
        getline(cin,Name); //to ensure we can input two names at once
        bool invalid = false;
        for (int i = 0; i < Name.length(); i++)
        {
            int charASCII = Name[i];
            if ((charASCII >= 65 && charASCII <= 90) || (charASCII >= 97 && charASCII <= 122) || charASCII == 32)
            {
                //do nothing
            }
            else
            {
                invalid = true;
            }
        }
        if (!invalid)
            break;

        cout << "Invalid Name try again!!\n";
    }

    cout<<"Please enter your phone number :";
    cin>>phone;

float jum;
string promo;
int n;
int qty[7];
int no[7];
long price[7],tot[4];
string name[7];
float change,pay,discount;
menu();
cout<<""<<endl;
cout<<"How many types of menu do you want: ";
cin>>n;
if(n>0 && n<=7) //loop for menus
{
    for(int i=0; i<n;i++)
    {
        cout<<"Enter your choice "<<i+1<<"=";
        cin>>no[i];
        cout<<"Enter quantity =";
        cin>>qty[i];
        if(no[i]==1)
        {
            name[i]="Cheese Burger";
            price[i]=8;
            tot[i]=price[i]*qty[i];
        }
        else if(no[i]==2)
         {
            name[i]="Chicken Wings(6 pieces)";
            price[i]=10;
            tot[i]=price[i]*qty[i];
        }
        else if(no[i]==3)
         {
            name[i]="12\" Pepperoni Pizza ";
            price[i]=20;
            tot[i]=price[i]*qty[i];
        }
         else if(no[i]==4)
         {
            name[i]="Fries";
            price[i]=5;
            tot[i]=price[i]*qty[i];
        }
        else if(no[i]==5)
         {
            name[i]="Onion Rings";
            price[i]=6;
            tot[i]=price[i]*qty[i];
        }
        else if(no[i]==6)
         {
            name[i]="Pepsi";
            price[i]=2;
            tot[i]=price[i]*qty[i];
        }
        else if(no[i]==7)
         {
            name[i]="Mineral Water";
            price[i]=3;
            tot[i]=price[i]*qty[i];
        }

        jum=jum+tot[i];
    }
    system("cls");
    menu();
    cout<<"_________________________________"<<endl;
    cout<<"Your choice is :"<<endl;
    for(int i=0;i<n;i++) //loop for order quantity
    {
        cout<<""<<qty[i]<<" portion "<<""<<name[i]<<endl;
        cout<<"Price/portion ="<<price[i]<<endl;
        cout<<"Total Price "<<name[i]<<"="<<tot[i]<<endl;

    }
    cout<<"We only accept cash payments"<<endl;//I state that my shop only receive cash payments
    cout<<"paid : Rm ";
    cin>>pay;
    cout<<"Do you have a promo code?"<<endl;
   cin>>promo;

 

   change=pay-jum;
    cout<<"________________________________"<<endl;
    cout<<"Your name is:"<<Name<<endl;
    cout<<"Phone no is:"<<phone<<endl;
    cout<<"Change: Rm"<<change<<endl;
    cout<<"Thank you for visiting";
}

else
    cout<<"Code your input doesnt exist";

 

 

    return 0;
}

 

Total Amount of A Bill
Bill ends in sen
Round off to the nearest 5 sen
Total amount before rounding (RM) Total amount after rounding (RM)
82.01
1,2
Down
82.00
82.02
82.03
3,4
Up
82.05
82.04
82.06
6,7
Down
82.05
82.07
82.08
8,9
Up
82.10
82.09
Transcribed Image Text:Total Amount of A Bill Bill ends in sen Round off to the nearest 5 sen Total amount before rounding (RM) Total amount after rounding (RM) 82.01 1,2 Down 82.00 82.02 82.03 3,4 Up 82.05 82.04 82.06 6,7 Down 82.05 82.07 82.08 8,9 Up 82.10 82.09
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY