Question

# Problem: -A chocolate bar at a local vending machine costs \$1 - Each chocolate bar has...

Problem:

-A chocolate bar at a local vending machine costs \$1

- Each chocolate bar has 1 coupon in it.

- We can redeem 6 coupons for 1 chocolate bar.

- Example: If Sam has \$6 dollars,

◦ \$6→ can be used to buy 6 chocolate bars.

◦ Sam will also get 6 coupons which can be redeemed to buy the 7th chocolate bar.

◦ Sam will now have 7 chocolate bars and 1 coupon left.

- How many chocolate bars can be purchased from the vending machine if we start with X dollars and always redeem coupons if we have enough for an additional chocolate bar ?

Task: Write a Java program that allows the user to enter a value for the amount s/he wants to use to buy chocolate bars and then, calculate the total # of chocolate bars that can be bought and the # of coupons that will be left.

Sample Output:

How many dollars would you like to spend on chocolate from the vending machine:

12

You can buy 14 chocolate bars and will have 2 coupons left!

Note: Ill give immediate upvote, thx

#### Earn Coins

Coins can be redeemed for fabulous gifts.