Question: Program Using C. A vending machine sells three kinds of candy, Airheads for 25 cents, Fun Dip for 40 cents, and Gummi Bears for 20

Program Using C.

A vending machine sells three kinds of candy, Airheads for 25 cents, Fun Dip for 40 cents, and Gummi Bears for 20 cents. Write a program that will simulate this vending machine. First, accept coins from the user (user enters #of cents as integers 5, 10, or 25), until the user enters zero. Then give the user a choice (with menu) for candies. If the user enters an invalid choice, display a Invalid selection message. If the amount deposited is sufficient, print the selection and calculate and display the change. If the amount deposited is not sufficient, display a message for insufficient amount and return the money.

A sample input/output:

Insert coins: 10

Insert coins:10

Insert coins: 10

Insert coins: 0

Please select from the following menu: 1 Airheads, 2 Fun Dip, 3 Gummi Bears

Enter your choice: 1

Candy dispensing

Your change is 5 cents

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!