Answer to Question #252619 in C++ for samad

Question #252619

A restaurant wants a program that allows its salesclerks to enter the number of bagels, donuts, and cups of coffee a customer orders. Bagels are Rs. 99, donuts are Rs.75, and coffee is Rs. 120 per cup. The program should calculate and display the total price of the customer’s order.


1
Expert's answer
2021-10-18T00:14:42-0400


/*
A restaurant wants a program that allows its salesclerks to enter the number of bagels, donuts, and cups 
of coffee a customer orders. Bagels are Rs. 99, donuts are Rs.75, and coffee is Rs. 120 per cup. The program should 
calculate and display the total price of the customer’s order.
*/
#include <iostream>


using namespace std;


int main()
{
    int no_bagels;
    int no_donuts;
    int no_cups;
    
    //get input from the user 
    cout<<"\nEnter number of bagels: ";
    cin>>no_bagels;
    cout<<"\nEnter number of donuts: ";
    cin>>no_donuts;
    cout<<"\nEnter number of cups: ";
    cin>>no_cups;
    
    //calculate the total price of the customer’s order
    int total=((no_bagels*99)+(no_donuts*75)+(no_cups*120));
    
    //display the total price of the customer’s order
    cout<<"\nTotal Price = Rs. "<<total;
    
    return 0;
}

Sample Output


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS