**** Vending Machine **** 1. Coke $1.25 2. Pepsi S1.00 3. Water $2.00 4. Coffee $1.50 5. Exit Menu Calculate tax (6% of purchase) Calculate total purchase (purchase + calculated tax) Enter your choice: 1 How many do you want? 1 How much is your payment? $2 Tax Amount: $0.07 Total Purchase: $1.32 Change: $0.68 Calculate change Programmer: insert your name here (payment – total purchase) HOMEWORK #6 PART 2 **** Vending Machine **** 1. Coke $1.25 2. Pepsi $1.00 Water $2.00 Display calculated values Coffee $1.50 5. Exit Menu Enter your choice: 2 How many do you want? 2 How much is your payment? S10 Return Code this program using the 4 functions indicated by the flowcharts. Use the tax rate as 6% (0.06). Be sure your code is structured (only one return in each function, no exit, or Tax Amount: $0.12 Total Purchase: $2.12 Change: $7.88 continue, or break-except in switch.) Upload to Blackboard: HW6Part2.cpp Programmer: insert your name here
C++ beginner level
Code should follow the flowchart design exactly.
Note that there are four functions that should all be called from main.
Use prototypes for your functions and code the function definitions AFTER main.
Check your code with several numbers to see if correct results are produced
Do NOT use loops
No input validation is required
Be sure your name appears at the beginning of your file and at the end as Programmer
Input items should be on the same line as the prompt.
For the exit option (5) assign the price a negative number. Inside main your code can
check if the price is positive (> 0). If it is, process the remaining three functions.
Always print your name as Programmer at the end.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images