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]
2 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]2 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
What does it mean to read visual and audio text
Ymorist [56]

To find meaning and decipher relationships between symbols and information


Talking books could be a means to automatize and generalize such an audio–visual reading experience. ... RWL consists of an experimental reading situation where one reads a text while one can hear it said aloud by a pre-recorded speaker or by a text-to-speech system.

8 0
3 years ago
I WILL GIVE BRAINLIST THING TO WHOEVER GIVES ME THE CORRECT ANSWER
Anna11 [10]

Answer:

Evaluate and compare free and commercial versions of the antivirus software provided at the link above. Based on the information you learned in this Unit, what differences, if any, are significant enough to warrant considering paying for the software versus using the free version (for a typical home user, if the specific annual costs were not a major consideration)? What is “missing” from the personal/home/base level subscription that you might want?

Explanation:

4 0
2 years ago
Compare and contrast system software and generalised software
jekas [21]
System software is a type of computer program that is designed to run a computer’s hardware and application programs.
Generalized software refers to software designed to read, process and write data with the help of functions performing specific audit routines and with self-made macros.
3 0
3 years ago
What is a layer, in the context of this lesson?
pshichka [43]

Answer:

A logical unit of a system.

Explanation:

i'm thinking your are talking about system layers such as the ISO? Layers help identify the order of how the whole system works.

7 0
2 years ago
Read 2 more answers
Malware is any malicious software installed on a computer or network without the owner’s knowledge.
Naya [18.7K]

Answer: True

Explanation: Malware is literally short for malicious software. The name that is given to any type of software that could harm a computer system or collect a user's data.

Hope it helped please mark as brainliest!

8 0
3 years ago
Other questions:
  • "under the control panel, what console contains print management, computer management, and event viewer?"
    11·1 answer
  • Trojan Horse is a malicious program and a virus is a program. <br><br> a. True <br> b. False
    6·1 answer
  • andy accidentally saved a file in the wrong folder. what is the quickest way to move the file? create a new file and save it in
    8·2 answers
  • Kuta software infinite pre- algebra multiplying polynomial and a monomial find product answer key
    14·1 answer
  • Give a logical expression with variables p,q, and r that is true if p and q are false and r is true and is otherwise false.
    5·1 answer
  • A porta power tool is what kind of tool
    9·1 answer
  • 2
    11·1 answer
  • Write a function named firstLast2 that takes as input an array of integers and an integer that specifies how many entries are in
    14·1 answer
  • Jonathan works with a team of graphic designers. They have a collection of images and have divided the image editing work among
    5·2 answers
  • Write a class called Date that represents a date consisting of a day, month, and year. A date object should have the following m
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!