Question

In: Computer Science

Using C++ Write a program to calculate the amount a customer should pay in a checkout...

Using C++ Write a program to calculate the amount a customer should pay in a checkout counter for the purchases in a bagel shop. The products sold are bagels, cream cheese, and coffee. Use the pseudo code discussed in the class to write the program. Make reasonable assumptions about the prices of bagel, cream cheese, and coffee. Declare prices of bagel, cream cheese, and coffee as constants.

Solutions

Expert Solution

Program:

#include <iostream>

using namespace std;

int main() {

int n,numberOfbagels,numberOfcream_cheeses,numberOfcoffees;

double bagels,cream_cheese,coffees,pay; // variable declaration

bagels =10; // consider bagel price as 10

cream_cheese = 20; // consider cream_cheese price as 20

coffees = 30; // consider coffee price as 30

cout <<"Enter number of bagels purchased: ";

cin>>numberOfbagels; // Accept number of bagels purchased

cout <<"Enter number of cream cheese purchased: ";

cin>>numberOfcream_cheeses; // Accept number of cream_cheeses purchased

cout <<"Enter number of coffes purchased: ";

cin>>numberOfcoffees; // Accept number of coffees purchased

pay = numberOfbagels*bagels + numberOfcream_cheeses *cream_cheese + numberOfcoffees * coffees; // Calculate the amount need to pay

cout<<"The amount customer should pay in a checkout counter for the purchases in a bagel shop: "<<pay<<endl; // print the amount need to pay

}

Output:


Related Solutions

Using C++ write a program to calculate the amount a customer should pay in a self...
Using C++ write a program to calculate the amount a customer should pay in a self checkout counter for his purchases in a bagel shop. The products sold are everything bagels, garlic bagels, blueberry bagels, cream cheese, and coffee. Using "doWhile loops" write the program to display the menu of the Bagel shop. Make the user buy multiple items of different choices. Finally display the total amount for the purchases. Below is my current code to work with. Please add...
Overview For this assignment, write a program that will calculate the amount that a customer spends...
Overview For this assignment, write a program that will calculate the amount that a customer spends on tickets at a movie theater. This program will be continued in program 3 so it is important that this program is completed. Basic Program Logic The basic logic for this program is similar to program 1: the user is asked to enter values, a calculation is performed, and the result of the calculation is displayed. For this program, prompt the user for the...
Write a program to help a small company calculate the amount of money to pay its...
Write a program to help a small company calculate the amount of money to pay its employees. In this simplistic world, the company has exactly three employees. However, the number of hours per employee may vary. The company will apply the same tax rate to every employee The program must be written in Java. Prompt the user for the inputs and store the values in variables Must include all the inputs and outputs listed here and perform the calculations correctly...
Write a program in python to calculate the amount each person must pay toward the bill...
Write a program in python to calculate the amount each person must pay toward the bill and toward the tip, for a group of friends who are eating out together. Since you are all friends, it is okay to split the costs evenly. Your program should take as input: The restaurant bill (without tax or tip) as a floating point number The sales tax rate as a floating point number (for example: an 8% tax rate would be 0.08) The...
Write a 'C' program to calculate the surface area of the cone and by using that,...
Write a 'C' program to calculate the surface area of the cone and by using that, also calculate the volume of the cone and print the values as surface area of the cone and volume of the cone. where as: surface area of the cone = πr2 (r is the radius of the surface) volume of the cone = (1/3)πr2h (h is the height of the cone)
1. a) Write a C program to calculate |A-B|. You should type in A and B...
1. a) Write a C program to calculate |A-B|. You should type in A and B when running the program. b) Write a C program using a function to calculate (A-B)^(1/2) -If A > B, the result will be (A-B)^(1/2) -If A < B,the result will be (B-A)^(1/2)i -You should type in A and B when running the program.
Integer value calculator: Write a program using C++ that acts as a calculator. The program should...
Integer value calculator: Write a program using C++ that acts as a calculator. The program should ask the user for two numbers and an operator. Then the program must print the result using the two input values and the operator. Prompts and input requirements. Ask the user for two integer values and a value that indicates the operation. Likely you will want to choose the normal operators: + - * / %. Output Requirements: Make your output easy to understand,...
C++ program using Eclipse IDE The C++ program should have concurrency. The C++ program should create...
C++ program using Eclipse IDE The C++ program should have concurrency. The C++ program should create 2 threads that will act as counters. One thread should count down from 5 to 0. Once that thread reaches 0, then a second thread should be used to count up to 20.
make a C++ program to calculate discount for a customer. If customer code equals 1 discount...
make a C++ program to calculate discount for a customer. If customer code equals 1 discount = 5% Any other code discount = 2% Display the discount
Using C++, write a program to calculate the height and velocity of a ball thrown upward...
Using C++, write a program to calculate the height and velocity of a ball thrown upward at a user-specified height and speed in 10 seconds. Position (h) and velocity (v) of the ball as a function of time are given by the equations: h(t) =(1/2)gt2 + v0t + h0 v(t) = gt + v0
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT