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
What facilitates the automation and management of business processes and controls the movement of work through the business proc
zhenek [66]

Answer:

D. Workflow management systems

Explanation:

Workflow management systems can be defined as a strategic software application or program designed to avail companies the infrastructure to setup, define, create and manage the performance or execution of series of sequential tasks, as well as respond to workflow participants.

Some of the international bodies that establish standards used in workflow management are;

1. World Wide Web Consortium.

2. Workflow Management Coalition.

3. Organization for the Advancement of Structured Information Standards (OASIS).

Workflow management systems facilitates the automation and management of business processes and controls the movement of work through the business process.

<em>The following are various types of workflow management systems used around the world; YAWL, Windows Workflow Foundation, Apache ODE, Collective Knowledge, Workflow Gen, PRPC, Salesforce.com, jBPM, Bonita BPM etc.</em>

3 0
3 years ago
1 pts Question 5 Which of the following calculations would evaluate to 12? (36) + 2/2, 3* ((6+2)/2), 3* 6+2/2, (306+ 2)/2​
julia-pushkina [17]

Answer:

Could you seperate them if they are different answers? I'm lost, sorry!

Explanation:

5 0
3 years ago
What are the answers for edhesive quiz 2? I can’t add more than 1 photo...
KatRina [158]

Answer:

i have no idea srry

Explanation:

hi

7 0
2 years ago
Describing Work Styles for Farmworkers and Laborers, Crop
Olegator [25]

Answer:

it is A,B,E,F,G

Explanation:

can i have brainliest please.

7 0
3 years ago
Read 2 more answers
Write a program that prompts the user for a word or phrase, and determines if the entry is a palindrome. A palindrome is a word
vekshin1

Answer:

Explanation:

The following code is written in Python. It asks the user for an input. Then cleans the input using regex to remove all commas, whitespace, and apostrophes as well as making it all lowercase. Then it reverses the phrase and saves it to a variable called reverse. Finally, it compares the two versions of the phrase, if they are equal it prints out that it is a palindrome, otherwise it prints that it is not a palindrome. The test case output can be seen in the attached picture below.

import re

phrase = input("Enter word or phrase: ")

phrase = re.sub("[,'\s]", '', phrase).lower()

reverse = phrase[::-1]

if phrase == reverse:

   print("This word/phrase is a palindrome")

else:

   print("This word/phrase is NOT a palindrome")

7 0
3 years ago
Other questions:
  • A bug collector collects bugs every day for 5 days. Write a program that keeps a running total of the number of bugs collected d
    12·1 answer
  • A county collects property taxes on the assessed value of property, which is 60 percent of its actual value. For example, if a h
    13·1 answer
  • _______ allows you to specify how a photo is positioned in the text of your document.
    11·1 answer
  • IT professionals recognize that successful systems must be user-oriented, and users need to be involved, formally or informally,
    11·1 answer
  • Apple's macOS and Microsoft Windows are examples of ________ software. utility application communication operating system
    13·1 answer
  • 2. a computer system designed to run games is called what?
    11·1 answer
  • What is the purpose of a mutator?
    8·1 answer
  • Write a pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0
    9·1 answer
  • Primary functions of lighting are sufficient light to...
    13·1 answer
  • ) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!