Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//please use c++ In this program you will practice aggregation of classes - this is a HAS A relationship. Create a Drink/Item class and a

//please use c++

In this program you will practice aggregation of classes - this is a "HAS A" relationship.

Create a Drink/Item class and a Vending machine class.

The Drink/Item class will hold names of items, prices of items, and quantity in the machine.

The vending machine attributes will be an array of Drink/Item objects, total amount of drinks sold, and name of machine.

Each time the program runs, it should enter a loop that performs the following steps.

1) Display the list of drinks available and their prices

2) The user should be allowed to either quit the program or pick a drink.

If the user selects a drink, he or she will next enter the amount of money that is to be inserted into the drink machine.

3)The program should display the amount of change that would be returned and subtract one from the number of drinks of that type left in the machine.

If the user selects a drink that is sold out, a message should be displayed.

4) The loop then repeats.

5) When the user chooses to quit the program it should display the total amount of money the machine has earned.

Input validation: When the user enters an amount of money, do not accept negative values or values greater than $5.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

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

Mastering Apache Cassandra 3 X An Expert Guide To Improving Database Scalability And Availability Without Compromising Performance

Authors: Aaron Ploetz ,Tejaswi Malepati ,Nishant Neeraj

3rd Edition

1789131499, 978-1789131499

More Books

Students also viewed these Databases questions

Question

Perform an Internet search. Discuss a company that uses EPLI.

Answered: 1 week ago

Question

How do you feel about employment-at-will policies? Are they fair?

Answered: 1 week ago