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

Homework Answers

Answer #1

***Please like, if u like my answer****

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Design a FSM for a Vending Machine In this task, you will design a FSM for...
Design a FSM for a Vending Machine In this task, you will design a FSM for a simple (albeit strange) vending machine of office supplies. The vending machine sells three possible items, each at a different cost: Item Cost Pencil 10 cents Eraser 20 cents Pen 30 cents The vending machines accepts nickels (worth 5 cents), dimes (worth 10 cents), and quarters (worth 25 cents). Physically, it is only possible to insert a single coin at a time. The vending...
1. Which of the following is NOT a problem with the life-events approach to stress? The...
1. Which of the following is NOT a problem with the life-events approach to stress? The link between scores on the SRRS and the development of physical and psychological problems is relatively weak. The SRRS assumes that a given life event will have the same impact on virtually everyone. The life-events approach assumes that change in itself, whether good or bad, produces stress. The SRRS assumes that genetic predispositions are linked to stress. 2. Which of the following is NOT...
1. A Treasury bond has a 10% annual coupon and a 10.5% yield to maturity. Which...
1. A Treasury bond has a 10% annual coupon and a 10.5% yield to maturity. Which of the following statements is CORRECT? * a. The bond sells at a price below par. b. The bond has a current yield less than 10%. c. The bond sells at a discount. d. a & c. e. None of the above 2. J&J Company's bonds mature in 10 years, have a par value of $1,000, and make an annual coupon interest payment of...
Question 1 If you are trying to make yourself as happy as you can be given...
Question 1 If you are trying to make yourself as happy as you can be given the constraints that you face, you are effectively: Select one: a. trying to find the intersection point between two budget constraints. b. trying to find the point on the budget constraint that is on the highest indifference curve. c. trying to find the point where the budget constraint and an indifference curve intersect. d. trying to find the point on an indifference curve that...
1) Describe an example of each of the following that may be found of your kitchen:...
1) Describe an example of each of the following that may be found of your kitchen: Explain how your choice falls into this category, and if there is a chemical name or symbol for it, provide that as well. Provide a photo of your example with your ID card in it. a) a compound b) a heterogeneous mixture c) an element (symbol) Moving to the Caves… Lechuguilla Caves specifically. Check out this picture of crystals of gypsum left behind in...
CASE #1: COCA COLA The Coca-Cola company started 110 years ago as a small, insignificant one...
CASE #1: COCA COLA The Coca-Cola company started 110 years ago as a small, insignificant one man business. Since then, it has grown into one of the largest companies in the world. The first chairman of the company was Dr. John Pemberton and the current chairman is Muhtar Kent. The demand for this product has made this company into a 50 billion dollar business. Coca-Cola was invented by Dr. John Pemberton, an Atlanta pharmacist. He concocted the formula in a...
Chapter 1: Bob becomes a real estate investor It is November 2007 and the economy of...
Chapter 1: Bob becomes a real estate investor It is November 2007 and the economy of Bob is a recent art school graduate working as an actor on a new Tyler Perry movie. Bob got a wonderful 6 month contract with a 3 month advance on pay. After Bob’s second day of work he was getting gas and a new Ferrari pulled up in the next stall. Bob was amazed and started a conversation. It turns out the owner of...
1. What are the requirements for successful price discrimination? Does this type of dry cleaning qualify?...
1. What are the requirements for successful price discrimination? Does this type of dry cleaning qualify? 2. What are other examples of price discrimination? 3. The effectiveness of price discrimination is a different question than whether businesses should be able to discriminate by price. Is this an issue that deserves regulation, or is it best left to the market? Why Women Pay More From dry cleaning to haircuts, women often pay more than men due to gender pricing. Find out...
Discuss ethical issues that can be identified in this case and the mode of managing ethics...
Discuss ethical issues that can be identified in this case and the mode of managing ethics Enron finds itself in this case. How would you describe the ethical culture and levels of trust at Enron? Provide reasons for your assessment. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among...
What role could the governance of ethics have played if it had been in existence in...
What role could the governance of ethics have played if it had been in existence in the organization? Assess the leadership of Enron from an ethical perspective. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among the top Fortune 500 companies, collapsed in 2001 under a mountain of debt...