Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SAMPLE OUTPUT! 1. Coke (can) 2. Coke (bottle) 3. Mountain Dew (can) 4. Water 5. Full Throttle 6. Quit the Program Enter your choice: 3

image text in transcribedimage text in transcribed

SAMPLE OUTPUT!

1. Coke (can) 2. Coke (bottle) 3. Mountain Dew (can) 4. Water 5. Full Throttle 6. Quit the Program Enter your choice: 3 The cost is: $0.75 1. Coke (can) 2. Coke (bottle) 3. Mountain Dew (can) 4. Water 5. Full Throttle 6. Quit the Program Enter your choice: 5 The cost is: $2.00 1. Coke (can) 2. Coke (bottle) 3. Mountain Dew (can) 4. Water 5. Full Throttle 6. Quit the Program Enter your choice: 6 Units Remaining: Coke (can) 6 Coke (bottle) 8 Mountain Dew (can) 7 Water 8 Full Throttle 7 Amount earned: $4.25

??Please use C++ for beginner!

Write a program that simulates a soft drink machine. The program should use a structure that stores the following data Drink Name Drink Cost Number of units currently in the machine The program should create an array of tive structures. The elements should be initialized with the following data Drink Name Cost 0.75 1.25 0.75 1.25 2.00 Number in Machine Coke (can) Coke (bottle) Mountain Dew (can) Water Full Throttle Each time the program runs, it should enter a loop that performs the following steps: A list of drinks is displayed on the screen. The user should be allowed to either quit the program or pick a drink. If the user selects a drink (that has not sold out), the program should display the cost of the drink and subtract one from the number of units of that drink left in the machine. If the user selects a drink that has sold out, a message should be displayed. The loop then repeats. When the user chooses to quit the program it should display the number of units of each drink left in the machine and the total amount of money the machine earned

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions