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
Lady bird [3.3K]
3 years ago
5

Suppose we wanted to make change for purchases and wanted to use the least number of coins possible. Here is a greedy algorithm:

for the change amount due, we always use the largest-face-value coin first. Assume we have only coins of quarters ($.25), twenties ($.20), and pennies ($.01). Assume the change is $.40: a. what would be the coins and their numbers obtained by the greedy algorithm above
Computers and Technology
1 answer:
love history [14]3 years ago
5 0

Answer:

Explanation:

The following code is a Python function that takes in the amount of change. Then it uses division and the modulo operator to calculate the number of coins that make up the changes, using the greatest coin values first.

import math

def amountOfCoins(change):

   print("Change: " + str(change))

   quarters = math.floor(change / 0.25)

   change = change % 0.25

   dimes = math.floor(change / 0.20)

   change = change % 0.20

   pennies = math.floor(change / 0.01)

   print("Quarters: " + str(quarters) + "\nDimes: " + str(dimes) + "\nPennies: " + str(pennies))

You might be interested in
Which type of app is the best choice when it is critical to be able to use the device's features but performance is not critical
Alchen [17]

Answer:

The answer is not native. I just got in wrong.

Explanation:

Edge 2021

4 0
3 years ago
Read 2 more answers
Gennie has just gotten her first smartphone with a touch screen. Mia is giving her a lesson on how to use the touch screen.
Helga [31]

Answer: D Stretch

Explanation:

Stretching is the process of changing the screen resolution of a phone or computer monitor so as to give a better view of it.

6 0
3 years ago
Negative numbers are encoded using the __________ technique. a. two’s complement b. floating point c. ASCII d. Unicode
OLEGan [10]

Negative numbers are encoded using the two’s complement technique. Two's complement is used to encode negative numbers.

Option  A is correct .

<h3>What method does the in data type use to store negative numbers?</h3>

Most implementations you're likely to encounter store negative signed integers in a form known as two's complement. Another important way of storing negative signed numbers is called one's complement. The one's complement of an N-bit number x is basically defined as x with all bits inverted.

<h3>What is encoding method?</h3>

An encoding technique is the application of established industry conventions to a coded character set to create a coded character scheme. Such rules determine the number of bits required to store the numeric representation of a given character and its code position in the encoding.

Learn more about two complement technique encoding :

brainly.com/question/26668609

#SPJ4

5 0
1 year ago
In the central processing unit (CPU).
mr Goodwill [35]
<h3>Answer : B.responsible for the logical order of processing and converting daya</h3>

<h3>Reason</h3>

As i said bro, in CPU there are ALU and CU where ALU is to do mathematics problem and CU where its to processing, converting data. CPU is like the brain of computer. But it can't be the input, the input can get through hardware, not CPU.

4 0
3 years ago
Which of these actions would NOT help you organize data efficiently?
Ilya [14]
The answer is Storing files on your desktop so that you can locate them easily
Hope this helps! :)
3 0
3 years ago
Other questions:
  • __________ software helps the computer carry out its basic operating tasks.
    8·1 answer
  • // Marian Basting takes in small sewing jobs.
    8·1 answer
  • Erica is working at a real estate office. She would like to organize the information about houses they have for sale. Erica shou
    13·2 answers
  • Which option describes wearable technology?
    5·2 answers
  • You are given two variables, already declared and assigned values, one of type double, named price, containing the price of an o
    7·1 answer
  • Can someone come and see if I have answered this question correctly? Please ...
    10·2 answers
  • To override a method in a subclass, the method must be defined in the subclass using the same signature and compatible return ty
    12·1 answer
  • What are the applications of computer in the field of study​
    12·2 answers
  • It is used to show the program and files that are open.
    12·1 answer
  • You use lpstat and determine that a user named User1 has placed two large print jobs in the queue for Printer1 that have yet to
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!