Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!