Question: Procedure / flow ( You do not need to follow the exact steps ) 1 . Create a double variable to hold the total money.

Procedure/flow (You do not need to follow the exact steps)
1. Create a double variable to hold the total money.
2. Write a loop to:
a) Prompt the user to select a product
b) Use an IF/ELSE-IF/ELSE-IF/ELSE to check which product is selected.
i. Prompt the user to enter the quantity for the selected product.
ii. Now you know which product is selected (also means that you know the unit price)
and the quantity, you can add it to the total money.
iii. The ELSE is for invalid user input send a warning.
c) The user may select multiple products ask the user if that is all for today.
i. Take user input and check if the loop should continue.
ii. Break the loop if the user indicates that is all for today.
3. Output the total money the user needs to pay.
Task A Vending Machine

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!