Question: How do I implement this within current vendingMachine class or under calculation class? The purchase process flow is as follows:Selecting (1) Feed Money allows the

How do I implement this within current vendingMachine class or under calculation class?

The purchase process flow is as follows:Selecting "(1) Feed Money" allows the customer to repeatedly feed money into the machine in whole dollar amounts.

The "Current Money Provided" indicates how much money the customer has fed into the machine.

Selecting "(2) Select Product" allows the customer to select a product to purchase.

Show the list of products available and allow the customer to enter a code to select an item.

If the product code doesn't exist, the vending machine informs the customer and returns them to the Purchase menu.

If a product is currently sold out, the vending machine informs the customer and returns them to the Purchase menu.

If a customer selects a valid product, it's dispensed to the customer.

Dispensing an item prints the item name, cost, and the money remaining. Dispensing also returns a message:

All chip items print "Crunch Crunch, Yum!"

All candy items print "Munch Munch, Yum!"

All drink items print "Glug Glug, Yum!"

All gum items print "Chew Chew, Yum!"

After the machine dispenses the product, the machine must update its balance accordingly and return the customer to the Purchase menu.

Selecting "(3) Finish Transaction" allows the customer to complete the transaction and receive any remaining change.

The machine returns the customer's money using nickels, dimes, and quarters (using the smallest amount of coins possible).

The machine's current balance updates to $0 remaining.

After completing their purchase, the user returns to the "Main" menu to continue using the 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 Databases Questions!