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
With the Linux operating system, its open source design means it can be used, modified and ______
nadya68 [22]

Answer:

distributed.

Explanation:

Because Linux is released under an open source license, which prevents restrictions on the use of the software, anyone can run, study, modify, and redistribute the source code, or even sell copies of their modified code, as long as they do so under the same license.

3 0
3 years ago
Decision making process
Zanzabum
Choice is the answer you want 
7 0
3 years ago
The database management system is a program used to create, process, and administer a database.
omeli [17]
The Answer is True.
7 0
4 years ago
How many bits must be “flipped” (i.e., changed from 0 to 1 or from 1 to 0) in order to capitalize a lowercase ‘a’ that’s represe
Neporo4naja [7]

<span>To capitalize lowercase “a” which is 0110001 which is “A” you will need to flip the following bites 01000001<span> as represented in ASCII. Since we are only looking at 2bit digit which is 0 and 1 which  has a 256 possible combinations from 0 up to 255. </span></span>


6 0
3 years ago
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. Which cable would s
jeka57 [31]

The answer is STP (Shielded Twisted Pair) cables .

Compared to Unshielded Twisted Pair, STP offers additional safeguards against Electromagnetic interference (EMI) and crosstalk. While UTP reduces some EMI, STP cables effectively block interference and ensure high-speed performance. STP cables have a metallic foil that cancels out electromagnetic interference. They are the preferred cables that protect against high-level EMI from, power lines, radar systems, or electromagnetic fields .



6 0
3 years ago
Other questions:
  • Monetary Policy can be either Expansionary or Contractionary. Which of the following actions classify as Expansionary Monetary P
    7·2 answers
  • bj;ljfg'cfmb dfl kbslf jflk[gkdblkfd lbrkjlfbbfkjbdfjkbadbjbbkvbk'lbk'blbf;l;lkb lm;flklmkjlvkljvkljvbfbdsjsfbbjjlkbfjklbkfj'lgg
    9·2 answers
  • 7. Which innovation in video games do you think has been most significant? Include at least one way that innovation affects the
    6·1 answer
  • Universal Containers has a requirement to integrate Salesforce with an external system to control record access. What option sho
    11·1 answer
  • Because the data was formatted the same in two inventory files, you decided to combine their contents into one file. Now you wan
    7·1 answer
  • Where can you access the property sheet
    8·1 answer
  • If you are asked to list your favorite websites in no particular order, you are relying on
    8·1 answer
  • Why do I keep getting points if I haven't answered anything? I don't want points.
    12·1 answer
  • Name and define (or list the set that defines) three of the four common data types in programming
    12·1 answer
  • A coffee shop is considering accepting orders and payments through their phone app and have decided to use public key encryption
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!