1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lions [1.4K]
3 years ago
7

Suppose we can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar is a coupon. We can redeem s

ix coupons for one chocolate bar from the machine. This means that once you have started buying chocolate bars from the machine, you always have some coupons. We would like to know how many chocolate bars can be eaten if we start with N dollars and always redeem coupons if we have enough for an additional chocolate bar.For example, with 6 dollars we could consume 7 chocolate bars after purchasing 6 bars giving us 6 coupons and then redeeming the 6 coupons for one bar. This would leave us with one extra coupon. For 11 dollars, we could consume 13 chocolate bars and still have one coupon left. For 2 dollars, we could have consumed 14 chocolate bars and have two coupons left.Write a program that inputs a value for N and outputs how many chocolate bars we can eat and how many coupons we would have left over. Use a loop that continues to redeem coupons as long as there are enough to get at least one chocolate bar.
Computers and Technology
1 answer:
Tanya [424]3 years ago
7 0

Answer and Explanation:

Using JavaScript:

/* program should take N input which represents the dollar amount and output how many chocolate bars and how many coupons we have*/

function chocolatebar(dollars){

var dollaramt= dollars;

var i;

for(i=0; i <= dollaramt; i++){

i=i+6

?

Alert ("you have 1 extra chocolate bar");

:

Alert ("keep buying chocolate bars to get more coupons for a bonus chocolate bar")

}

}

*

You might be interested in
The chain of _____ documents that the evidence was under strict control at all times and no unauthorized person was given the op
Arturiano [62]

Answer:

custody.

I hope I could help

4 0
2 years ago
I have all of the points and brainliest, but it won't level up, I don't know why, anyone know why?
ozzi

Answer:

just refresh

Explanation:

you did level up i just checked, it just hasnt updated for you

8 0
2 years ago
Read 2 more answers
What would be one duty of a network administrator
gulaghasi [49]

Answer:

designing the computer network

Explanation:

8 0
3 years ago
In 3-5 sentences, describe how you would insert a graph in your word-processing document.
Allisa [31]

Answer:

Click the “Insert” tab, then click the “Chart” button on the Illustrations section to open the “Insert Chart” pop-up window.

Select the type of graph to add to the document, such as a pie chart or bar graph. ...

Click “OK” and Word adds a chart with generic data points to the document.

Explanation:

3 0
3 years ago
What is ASP.NET ?why is it important?
miskamm [114]
<span>ASP.NET is an open-source server-side web application framework designed for web development to produce dynamic web pages.

Without it, we would be lost on the internet, or possibly wouldn't even have internet. Whats the point of Wifi without web pages?</span>
6 0
3 years ago
Other questions:
  • Ryan is looking at investment opportunities as a cloud service provider. He wants to invest in a deployment-based cloud model th
    11·2 answers
  • A company has a network printer that is utilzed by several departments. Although the printer shows online and other departments
    11·1 answer
  • Convert to octal. Convert to hexadecimal. Then convert both of your answers todecimal, and verify that they are the same.(a) 111
    12·1 answer
  • Give an example of an app, website, or a game that used addictive design. Describe three features of addictive design it uses.
    11·2 answers
  • This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
    8·1 answer
  • Which statement is true about the purpose of a work in process constraint?
    15·1 answer
  • A user contacted the help desk to report that the laser printer in his department is wrinkling the paper when printed. The user
    5·1 answer
  • 2. A well designed high-volume system will minimize _________ inventory and reduce _____________for the product or service. a) w
    7·1 answer
  • Global address list characteristics
    11·1 answer
  • It is manadatory to include a banner marking at the top of the page to alert the user that cui is present.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!