I have been assigned to create a program to simulate a soft drink machine. The following structure is supposed to be used to store the following data:

Drink Name
Drink Cost
Number of Drinks in machine

I am suppose to create an array of five structures and initialize the elements with the following data using c-style string for names.

Cola .75 20 qty
Rootbeer .75 20 qty
Lemon-Lime .75 20 qty
Grape Soda .80 20 qty
Cream Soda .80 20 qty

I am suppose to use an enumerated data type for the drink type. This type is the index into the array of structures.

Each time the program druns, it should enter a loop that performs the following steps:
A list of drinks is displayed
the user can quit or choose the drink

if a drink is selected:
the user enters the amount of money to be inserted
the program displays the amount of change that would be returned
the program subtracts one from the number of that type of drink left in the machine
if the user chooses a drink that is sold out, a "sold out" messege is displayed.
the loop repeats
when the user chooses to quit the program
the program displays the total of money the machine earned

input validation: when the users enters an amount of money, do not accept negative values or values greater than $1.00

I have been going through a lot in my life right now and am having a lot of trouble catching up in this class. I would apprecate any and all help on this program that is due tomorrow. Thanks everyone for the help.

9 Years
Discussion Span
Last Post by Ancient Dragon

>>I would apprecate any and all help on this program that is due tomorrow
I doubt you will make that deadline and we will not write the program for you. If you have had a lot of personal problems that prevented you from studying, then you should probably drop this course and retake it next semester.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.