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
miskamm [114]
4 years ago
6

A cashier distributes change using the maximum number of five-dollar bills, followed by one-dollar bills. Write a single stateme

nt that assigns num_ones with the number of distributed one-dollar bills given amount_to_change. Hint: Use %. Sample output with input: 19 Change for $ 19 3 five dollar bill(s) and 4 one dollar bill(s)
Computers and Technology
1 answer:
Allushta [10]4 years ago
4 0

Answer:

<em>num_ones = amount_to_change % 5</em>

Explanation:

It is given that the cashier has to change the money in the maximum number of 5 dollar bills and remaining as $1 bills.

We have to write a single statement of code to assign the value to variable <em>num_ones </em>to find the value of $1 bills given <em>amount_to_change.</em>

<em />

Let us solve this by taking example:

If <em>amount_to_change </em>= $19

Then total number of $5 bills that can be given is 3. And amount that can be given as $5 bills is \bold{3 \times 5  = \$15}

So, the remaining amount i.e. $19 - $15 = $4 will be given as one dollar bills.

Out of these $19, 4 bills of $1 can be found using the <em>Modulus (%) operator.</em>

<em></em>

Modulus operator leaves the remainder i.e.

Output of <em>p % q </em>is the remainder when a number 'p' is divided by 'q'.

19 % 5 = 4

4 is the number of one dollar bills to be given.

So, single line of code for the number of one dollar bills can be written as:

<em>num_ones = amount_to_change % 5</em>

<em />

<em />

Let us try it for <em>amount_to_change  = </em>$30

We know that 6 number of $5 bills can be used to change the amount of $30 and no one dollar bill required.

<em>num_ones = 30 % 5 = </em>0 (because 30 is completely divisible by 5 so remainder is 0)

So, the correct statement is:

<em>num_ones = amount_to_change % 5</em>

You might be interested in
Type the correct answer in the box. Spell all words correctly.
erica [24]

Answer:

Storing data on the cloud enables access from any location.

Explanation:

4 0
3 years ago
2. How can recovery handle transaction operations that do not affect the database, such as the printing of reports by a transact
Reil [10]

Answer:

Explanation:

great question but dont know

7 0
4 years ago
Place the basic steps in the order that programmers would perform them when creating a new program.
Alisiya [41]

Answer:

Defining the program

Planning the program

Coding the program

Testing the program

Documenting the program

Explanation:

Defining the program is the first step in creating a computer program. Here the problem is defined, what are we creating? What is the objective or what problem are we solving? The second step is paining or design of the program. This has to do with creating algorithms for the programs which constitute the step by step logical arrangement that the program would need to solve the problem. The third step is coding the program which entails bringing the algorithm to live in a way that the computer would understand. The fourth and final step have to do with debugging/testing the program for effectiveness and documenting for commercial and programmers use respectively.

7 0
4 years ago
Read 2 more answers
If a system contains 1,000 disk drives, each of which has a 750,000- hour MTBF, which of the following best describes how often
exis [7]

Answer:

once per month

Explanation:

The correct answer is - once per month

Reason -

Probability of 1 failure of 1000 hard disk = 750,000/1000 = 750 hrs

So,

750/24 = 31.25 days

⇒ approximately one in a month.

6 0
3 years ago
Gina is upgrading your computer with a new processor. She installs the processor into your motherboard and adds the cooling syst
Afina-wow [57]
Problem :
Gina forgot to install the softwares (drivers) capable of running the processor’s commands onto the device.
3 0
2 years ago
Other questions:
  • An interface that doesn’t contain any constants or methods is called a ____________ interface.
    13·1 answer
  • While trying to solve a network issue, a technician made multiple changes to the current router configuration file. The changes
    7·1 answer
  • Computers use two different types of memory to operate.
    10·2 answers
  • Presentation software allows users to _____.
    15·1 answer
  • Which system is a type of artificial intelligence that uses a database, containing facts and rules, to provide assistance to use
    9·1 answer
  • Examine the following algorithm.
    9·1 answer
  • In which circumstances would the view side by side feature be useful or helpful.
    15·2 answers
  • What is the name used for the camera’s view from a single position?
    9·1 answer
  • This class is missing a number of functions. Rewrite the class declaration to follow best practices, e.g, operators, three impor
    10·1 answer
  • Show the B-tree that results when inserting R,Y,F,X,A,M,C,D,E,T,H,V,L,W,G (in that order)branching factor oft= 3. You need only
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!