Question: 1. (This problem is worth 16 points) The objective is to write a C++ program for a vending machine. The vending machine has three products,

1. (This problem is worth 16 points) The objective is to write a C++ program for a vending machine. The vending machine has three products, a) a bag of Cheeto's, that cost $1.85, b) a Kit-Kat bar, that costs $1.65, and c) an Apple, that costs $1.15. The machine is originally loaded with 10 of each product. Your machine will only take $1 coins, quarters, dimes and nickels. In your program, you should ask your user what they would like to purchase, and list the three items, their cost, and how many are left. Ask them which item they would like to buy and the quantity. Have them deposit their coins, one at a time. As they deposit a coin, communicate how much they still owe. If they deposit more than the sale amount, calculate their change and return to them the coinage they are receiving back (for example, 2 quarters and 1 dime). After the transaction, repost the original screen listing products available with pricing, updating the quantity left of each item. Before you write any lines of code, do the following: a. Draw a flow diagram of your program design (hand drawn is fine). Label each block as a subtask, and include a short description of what the block does. Use arrows to indicate loops. Identify blocks that are functions. b. Design functions that you will use. For each function, identify the function name, the input arguments, including variable type, and the return type. Also, indicate any values to be returned through the argument list. Write the function declaration. Also, write a brief statement of the purpose of the function. Parts a. and b. must be submitted with your HW. Next, complete the following as you write your code: c. In your replit file, write your function declarations just after your \#include statements. d. Write your main program to reflect your flow diagram. e. Write your function definitions after your main program. f. Test your program by having at least 5 customers make purchases. At least one of each item should be purchased in the testing. At least 4 customers should not use exact change in their purchase. One customer should use exact change
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
