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
What is included on the HP PC Hardware Diagnostics 3-in-1 USB Key that allows you to recover systems that cannot boot?
algol13

Answer:

HP PC Hardware Diagnostics UEFI

Explanation:

The 3-in-1 HP PC Hardware Diagnostics UEFI USB Key helps the client distinguish potential software, hardware, and Operating System issues. Both older and newer HP Desktop and Laptop PCs come with this tool installed. By default, it operates outside the OS to detach equipment issues from other system issues. In the event you do not have it pre-installed, you can get it from the official HP site.

3 0
3 years ago
Out of the following, find those identifiers, which cannot be used for naming Variables, Constants or Functions in a python prog
Alecsey [184]

Answer:1. Introduction to Python

1.1 A Simple Python Program

1.2 Creating and Running a Python Program

2. Virtual Data Storage

3. Statement Types

3.1 Input/Output Statements

3.2 The Assignment Statement

3.3 Control Statements

4. Another Example

5. Managing Complexity

5.1 Divide and Conquer

5.2 Using and Writing Functions

6. Object-Oriented Programming

6.1 What Is It?

6.2 Python and OOP

6.3 One More Example

6.4 What Have We Gained?

7. Graphical Programming

7.1 Graphics Hardware

7.2 Graphics Software

8. Conclusion

E X E R C I S E S

A N S W E R S T O P R A C T I C E P R O B L E M S

Explanation: I got you bruv.

7 0
3 years ago
Which of the following is true of how packets are sent through the internet?
horrorfan [7]

Answer:

It is A: Packet metadata is used to route and reassemble information travelling  through the internet.

Explanation:

Step 1: The Internet works by chopping data into chunks called packets. Each packet then moves through the network in a series of hops. Each packet hops to a local Internet service provider (ISP), a company that offers access to the network -- usually for a fee

Step 2: Entering the network

Each packet hops to a local Internet service provider (ISP), a company that offers access to the network -- usually for a fee.

Step 3: Taking flight

The next hop delivers the packet to a long-haul provider, one of the airlines of cyberspace that quickly carrying data across the world.

Step 4: BGP

These providers use the Border Gateway Protocol to find a route across the many individual networks that together form the Internet.

Step 5: Finding a route

This journey often takes several more hops, which are plotted out one by one as the data packet moves across the Internet.

Step 6: Bad information

For the system to work properly, the BGP information shared among routers cannot contain lies or errors that might cause a packet to go off track – or get lost altogether.

Last step: Arrival

The final hop takes a packet to the recipient, which reassembles all of the packets into a coherent message. A separate message goes back through the network confirming successful delivery.

3 0
3 years ago
Read 2 more answers
PYTHON 3 CODE HS HELP PLZ
Tju [1.3M]

Answer:

B

Explanation:

It adds the same number over and over again, 'number' times.

This is number*number, a.k.a. number². (squared)

3 0
2 years ago
When programming, which of the following is true of the editor?
OLEGan [10]

Answer:

The correct answer is It is a program that checks for grammatical errors.

Explanation:

In programming, when we want to check that our grammar is correct, we can use an editor.

This is a program that allows you to correct spelling through a software application. It analyzes the entered text and automatically checks whether it is spelled correctly or not, comparing the words with its internal database.

Given this information we can say that the correct answer is It is a program that checks for grammatical errors.

5 0
3 years ago
Other questions:
  • The Internet of Things (IoT) is a concept with emphasis on machine-to-machine communications to describe a more complex system t
    10·1 answer
  • You save $500 in a retirement account at age 25. it increases an average of 10% per year until you are 65. which formula and res
    13·1 answer
  • Which term is used to describe the science of examining raw data, removing excess noise from the dataset, and organizing the dat
    15·1 answer
  • Changes in computer technology have an effect on _____.
    13·1 answer
  • Advantages of purchasing a software package over developing software in-house include all of the following except ____. Group of
    13·1 answer
  • What are the two types of digital water marking?
    5·1 answer
  • The continue statement _________.
    11·1 answer
  • In a List of Positive Integers, Set MINIMUM to 1. For each number X in the list L, compare it to MINIMUM. If X is smaller, set M
    11·1 answer
  • QUICK HELP ME PLEASE
    9·1 answer
  • TCP and the User Datagram Protocol (UDP) provide _________ between processes on any two of those hosts. A. address translation B
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!