Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Eclipse create a java program that, mimics the behavior of a vending machine. A Vending Machine profile * takes payment in coins, * allows

Using Eclipse create a java program that, mimics the behavior of a vending machine.

A Vending Machine profile

* takes payment in coins,

* allows the user to select an item with a known value in dollars and cents by entering in dollars and cents

* then gives the change in coins

Write the algorithm and a program that solves the above vending machine problem, by mimicking the vending machine's behavior.

The user of the vending machine will:

enter coins by entering their money as:

the number of dollars

the number of quarters

the number of dimes

the number of nickels

select an item by entering the cost of the item:

in dollars

and in cents (entered to the nearest 5 cents. ie no pennies)

Then the vending machine will

display the amount of change, in dollars and cents,

followed by the number and types of coins used for that change:

dollars

quarters

dimes

nickel

Example of the program running:

Please enter number of dollars inserted

3

Please enter number of quarters inserted

5

Please enter number of dimes inserted

7

Please enter number of nickels inserted

3

You inserted $5.10

Please enter the dollar cost of the item

2

Please enter the remaining cost of the item as cents, in 5 cent increments

35

Your item cost $2.35

Your change is $2.75 as:

dollars: 2

quarters: 3

dimes: 0

nickel: 0

When finished, submit your program as an exported Eclipse project zip file. You must also submit your Algorithm for the program. The algorithm will be included in the program file as Java Doc comments. Java doc comments use /** to open and */ to close the comment.

Example: /**

*This is a line in a java doc comment block.

*

*This is another line in the same block.

*/

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago