Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write C# program that simulates a soft drink machine. The program should use a struct that stores the following data: Drink Name Drink Cost Number

image text in transcribed

Write C# program that simulates a soft drink machine. The program should use a struct that stores the following data: Drink Name Drink Cost Number of Drinks in Machine The program should create an array of five elements of type struct. The elements should be initialized with the values from the file "drinkMachine.txt". 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 quit the program or pick a drink. If the user selects a drink, she will next enter the amount of money that is to be inserted into the drink machine. The program should display the amount of change that would be returned and subtract one from the number 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 choses to quit the program it should display to the screen the total amount of money the machine earned. Input validation: When the user enters an amount of money, do not accept negative values, or values greater than $1.00

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_2

Step: 3

blur-text-image_3

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

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

=+j on to staff their operations in the global marketplace.

Answered: 1 week ago