Question

Write a C++ program to tally up the total cost of a customer order for Roasterie...

Write a C++ program to tally up the total cost of a customer order for Roasterie coffee shop.

The coffee shop offers the following items on its menu:

• Coffee($2.5)

• Tea($2.25)

• Soda($1.85)

• Juice($2)

• Special Item(self defined price)

The program takes input from the user about all the items and amounts. Below is an example:

- Please input item number:

1. Tea 2. Soda 3. Juice 4. Special Item

- 1

- How many:

- 3

- Please input item number:

1. Tea 2. Soda 3. Juice 4. Special Item

- 2

- How many:

- 1

If Special Item is entered, the program should ask about the item name and item price:

- Please input item number:

1. Tea 2. Soda 3. Juice 4. Special Item

- 4

- Item Name:

- Cheesecake

- Price:

- 6

- How many:

- 2

If nothing is inputted, the program prints the summary of the order, and the total price:

- You ordered: 3 Tea, 1 Soda, 2 Cheesecake. Total cost: $20.6

Use Functions in your Project.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :

#include <iostream>

#include<stdlib.h>

using namespace std;

void order();

int main() {

cout << "Welcome to Roasterie Coffee Shop\n";

order();

return 0;

}

void order() {

//declare all variables related to products and totalcost

int n,c_count=0,t_count=0,s_count=0,j_count=0,st_count=0;

float c_sum=0,t_sum =0,s_sum =0,j_sum =0,st_sum= 0,price;

char item[100];

do {

cout << "\nPlease input item number:\n" << "1. Coffee 2. Tea 3. Soda 4. Juice 5. Special Item\n";

cin>>n;

switch (n) {

//for coffee

case 1 : cout<<"How many:\n";

cin>>c_count;

c_sum = c_count *2.5;

break;

//for tea

case 2 : cout<<"How many:\n";

cin>>t_count;

t_sum = t_count *2.25;

break;

//for soda

case 3 : cout<<"How many:\n";

cin>>s_count;

s_sum = s_count *1.85;

break;

//for juice

case 4 : cout<<"How many:\n";

cin>>j_count;

j_sum = j_count *2;

break;

//for specific item

case 5 : cout<<"ItemName:\n";

cin>>item;

cout<<"Price:\n";

cin>>price;

cout<<"How many:\n";

cin>>st_count;

st_sum = st_count *price;

break;

//when none of the input is selected, print cost

default : cout<<"You ordered: " <<c_count << " Coffee, "<<t_count << " Tea, " <<s_count << " Soda, "<<j_count <<" Juice, "<<st_count << " Cheesecake.\n" <<" Total cost: " <<c_sum +t_sum +s_sum +j_sum +st_sum <<"\n";

exit(0);

}

} while(1);

}

Output :

Add a comment
Know the answer?
Add Answer to:
Write a C++ program to tally up the total cost of a customer order for Roasterie...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Sample Execution – Level 3 Welcome to your Menu Creation system. How many items would you...

    Sample Execution – Level 3 Welcome to your Menu Creation system. How many items would you like to have on your menu? 2 Create your menu! Enter item #1: Coffee Enter the number of toppings: 2 Enter topping #1: Whipped Cream Enter topping #2: Cinnamon Enter item #2: Tea Enter the number of toppings: 2 Enter topping #1: Milk Enter topping #2: Sugar May I take your order? This is the menu: Coffee Tea Pop How many items would you...

  • Write a program to keep track of the inventory of grocery store. Write a test program...

    Write a program to keep track of the inventory of grocery store. Write a test program that prompts the user to enter how many items of inventory the store has. After that enter item name, quantity and price of each item in three different arrays called Itemname, Quantity and Price. Than calculate the Total=Quantity*Price of items in store and FinalTotal of all the items and print in following exact format using array: Sample run of program: Enter number of items...

  • In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast...

    In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Name Price Egg (cooked to order)...

  • Your assignment is to create a restaurant ordering system where the cashier can create the menu...

    Your assignment is to create a restaurant ordering system where the cashier can create the menu and then take in the order and display the order back to the customer Sample Execution – Level 1 Welcome to your Menu Creation system. How many items would you like to have on your menu? 2 Create your menu! Enter item #1: Coffee Enter item #2: Tea This is the menu: Coffee Tea What would you like to order? Cake That isn’t on...

  • Write a C++ program that calculates the discount of the original price of an item and...

    Write a C++ program that calculates the discount of the original price of an item and displays the new price, and the total amount of savings. This program should have a separate header (discount.h), implementation (discount.cpp) and application files (main.cpp). The program must also have user input: the user must be prompted to enter data (the original price, and the percent off as a percentage). There must also be a validation, for example: Output: “Enter the original price of the...

  • CODING IN PYTHON: Assume a customer is at a store purchasing exactly 4 items. The cashier...

    CODING IN PYTHON: Assume a customer is at a store purchasing exactly 4 items. The cashier inputs the items and their prices into the computer. Someone has provided the cashier a Python program that does the following: 1. Asks cashier for name of each item (use short names like nails, paint, etc.) 2. Asks cashier for price of each item A) Assume items are between $5 & $20. Have 1 item that is less than $10 3. Prints receipt header...

  • C++ Instructions Redo Exercise 4 so that the customer can select multiple items of a particular...

    C++ Instructions Redo Exercise 4 so that the customer can select multiple items of a particular type. A sample output in this case is: Welcome to Johnny's Resturant ----Today's Menu---- 1: Plain Egg $1.45 2: Bacon and Egg $2.45 3: Muffin $0.99 4: French Toast $1.99 5: Fruit Basket $2.49 6: Cereal $0.69 7: Coffee $0.50 8: Tea $0.75 You can make up to 8 different selections Do you want to make selection Y/y (Yes), N/n (No): Y Enter item...

  • Assume that a restaurant offers the following breakfast items: Plain Egg $1.45 Bacon and Egg $2.45...

    Assume that a restaurant offers the following breakfast items: Plain Egg $1.45 Bacon and Egg $2.45 Muffin $0.99 French Toast $1.99 Fruit Basket $2.49 Cereal $0.69 Coffee $0.50 Tea $0.75 Write a program that stores the following data about each menu item in a structure called MenuItem: • A description of the menu item • The price of the menu item • A count of the number of times the item has been ordered
 The program should keep an array...

  • Need this program in C#. Thank you 3/19 Lab11 PartC Dur Scenario/Summary Write a windows console...

    Need this program in C#. Thank you 3/19 Lab11 PartC Dur Scenario/Summary Write a windows console application that holds data about an item in a retail store. Your class should be named Retailltem and should hold data about an item in a retail store. The class will have the following member variables. Description- string holding the description of the item, unitsOnHand - int that holds the number of units in inventory Price - double that holds the price of the...

  • Order up:: Write a program that will be used to keep track of orders placed at...

    Order up:: Write a program that will be used to keep track of orders placed at a donut shop. There are two types of items that can be ordered: coffee or donuts. Your program will have a class for each order type, and an abstract superclass. Coffee orders are constructed with the following information: quantity (int) - how many coffees are being ordered size (String) - the size of the coffees (all coffees in the order have the same size)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT