Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment # 1 - Hogwarts Express Trolley Menu Due: Thursday 1 / 2 5 / 2 0 2 4 , 1 1 : 5 9
Assignment # Hogwarts Express Trolley Menu
Due: Thursday ::pm
Objectives
To practice with writing a small C main program, along with compiling and running it
To practice with basic C inputoutput features, along with some simple decimal formatting
To practice with basic arithmetic operators in C
Task
Create a program Filename: menu.cpp that will simulate ordering different goodies from the Trolley as if you are on your way to Hogwarts. You will ask the user how many of certain candy items they'd like, calculate, and print the total for the customer, including wizard tax. Yes there's even taxes in the wizarding world
Declare CONSTANT double variables representing the prices of each item on the menu. The prices should be:
Bertie Botts Every Flavour Beans: $
Chocolate Frog: $
Exploding BonBons: $
Cauldron Cake: $
Use these variables anytime you need to do calculations that involve the prices of these items, or anytime you DISPLAY the prices of these items.
Declare a CONST double variable to represent the Wizard Tax rate of
Welcome the user as seen in the sample runs, and print the Trolley menu. In the menu printout, make sure to use the CONST double variables you declared that represent the prices of each item to display on the menu. This way, in case the prices of the item changes, your menu will reflect the accurate prices.
As you can see in the sample execution below, you should ask the customer how many of each item that they would like, in order. These valuesanswers provided by the user will be of type int, and it's assumed that the user will only enter ints here. Prompt the user for these values exactly as I've done below. Store the amounts of each item the customer wants in variables you create to store these quantities.
After collecting the user's order quantities, your program should produce the output demonstrated in the sample execution, calculating and then printing the total before tax, tax, and total after tax. Also note that all prices must be printed to two decimal places
You may assume that all user input will be correct types. You do not need to handle any situation in which the user enters data of a wrong type for instance, a letter Character instead of an integer
Your goal is to make your output look as close to mine as possible obviously the user entered values can change with every run of the program
General Requirements
No global variables variables outside of main
Declare all variables at the top of your functions including main instead of scattered throughout your code
All input and output must be done with streams, using the library iostream
You may only use the iostream and iomanip libraries you do not need any others for these tasks
NO C style printing is permitted. Aka don't use printf Use cout if you need to print to the screen.
When you write source code, it should be readable and welldocumented comments
Make sure to read your Style Guidelines pdf on our canvas home page for our Programs. This is a graded factor of your homework.
Include the exact header given in our starter code on our canvas home page at the top of your source code file. Edit it appropriately with your information.
Write your program so that the output looks EXACTLY like the sample execution shown below this means same wording, spacing, special characters you see in the sample below, and formatting of numbers Use these sample runs to ensure you're doing your math correctly, but also make sure to test with other user entered values as well. Aka, you should not hard code any of these values in your program, the program you write should figure out the solution based on any user entered values.
Note: The underlining in the sample execution below is used to illustrate what the user is typing in obviously the underlining will not appear on the console.
Sample run : user input underlined
Anything off of the trolley, dears?
TROLLEY MENU
Bertie Bott's Every Flavour Beans: $
Chocolate Frog: $
Exploding Bonbons: $
Cauldron Cakes: $
How many Bertie Bott's Every Flavour Beans?
How many Chocolate Frogs?
How many Exploding Bonbons?
How many Cauldron Cakes?
Total Before Wizard Tax: $
Tax : $
Total After Wizard Tax: $
Enjoy your candies!
Sample run : user input underlined
Anything off of the trolley, dears?
TROLLEY MENU
Bertie Bott's Every Flavour Beans: $
Chocolate Frog: $
Exploding Bonbons: $
Cauldron Cakes: $
How many Bertie Bott's Every Flavour Beans?
How many Chocolate Frogs?
How many Exploding Bonbons?
How many Cauldron Cakes?
Total Before Wizard Tax: $
Tax : $
Total After Wizard Tax: $
Enjoy yo
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started