vending machine project

Simulate the operation of a Coke machine. This machine offers Coke, Coke Zero, and Caffeine-free Diet Coke. All drinks cost $1 (100 cents). The machine does not take dollar bills or pennies, but it does take nickels, dimes, and quarters. When enough money has been entered, a drink may be selected, and any change is returned (the specific coins are listed).Only coins in denominations of 5, 10, and 25 cents are accepted. Any other denomination (33 cents, 50 cents, etc.) is rejected and returned. More than one drink may be purchased (that is, the program doesn't quit after selling one drink).There is no way to turn off the coke machine.

this is what I have so far, I don't know what to do next.
#include <iostream>
using namespace std;
int main ()
{
Int choice;
Float number;
Char beverage;
Cout<< fixed <<showpoint << setprecision(2);

Do
{
Cout<< “Coke Machine Menu:” <<endl;
Cout<< “1. Coke $1.00”<<endl;
Cout<< “2. Coke Zero $1.00” <<endl;
Cout<< “3. Caffeine free Diet Coke $1.00<<endl;
Cout<< “Make a selection from the vending machine.” <<endl;
Cout<<”The only acceptable coins are nickels(5 cents), dimes(10 cents), and quarters(25 cents)<<endl;
Okay, next what you should do is write some code that can add up how much money (in the form of nickles, dimes, and quarters) the purchaser has put into the machine.

Then, write some code that lets the purchaser choose his drinks.

Then, write some code that figures out what the total cost of those drinks will be.

Then, write some code that determines how much change to give, if any. Or, for that matter, which tells the purchaser he needs to put in more money.

I also see several problems with the code you've posted, but we can tackle them after you've made a good faith effort at solving this exercise and shared with us just what you've come up with.

Good luck!


Last edited on
I already figured it out, but thank you! I just had a little trouble figuring out where to start.
If you could take a look at my other question on a different program, that would be great.
Topic archived. No new replies allowed.