Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Problem Write a program that simulates a vending machine. Products can be purchased by inserting coins with a value at least equal to

In Java

Problem Write a program that simulates a vending machine. Products can be purchased by inserting coins with a value at least equal to the cost of the product. A user select a product from a list of available products, add coins, and either gets the products or gets the coins returned. The coins are returned if insufficient money was supplied or if the product it's sold out. The machine does not give change if too much money was added. Products can be restocked and money remove by an operator. Your solution should include a class VendingMachine that is not coupled with the Scanner or PrintStream classes.

Sample output S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit a Description: Cookie Price: 2.00 Quantity: 3 S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit A Description: Candy Price: 1.00 Quantity: 2 S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit S Cookie @ $2.0 Candy @ $1.0 S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit b A) Cookie @ $2.0 B) Candy @ $1.0 a Insufficient money S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit i A) nickel @ 0.05 B) dime @ 0.1 C) quarter @ 0.25 D) dollar @ 1.0 d S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit i A) nickel @ 0.05 B) dime @ 0.1 C) quarter @ 0.25 D) dollar @ 1.0 d S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit b A) Cookie @ $2.0 B) Candy @ $1.0 a Purchased: Cookie @ $2.0 S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit s Cookie @ $2.0 Candy @ $1.0 S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit b A) Cookie @ $2.0 B) Candy @ $1.0 b Insufficient money S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit i A) nickel @ 0.05 B) dime @ 0.1 C) quarter @ 0.25 D) dollar @ 1.0 d S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit i A) nickel @ 0.05 B) dime @ 0.1 C) quarter @ 0.25 D) dollar @ 1.0 d S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit i A) nickel @ 0.05 B) dime @ 0.1 C) quarter @ 0.25 D) dollar @ 1.0 d S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit b A) Cookie @ $2.0 B) Candy @ $1.0 b Purchased: Candy @ $1.0 S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit r Removed: $5.0

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

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions