Question

Instructions

You will be given an integer value less than 20. Based on the number given, you will calculate the combination of ten and five dollar bills, toonies (2 dollar coins) and loonies (1 dollar coins) needed to pay such that you pay using as many of the largest bills/coins first.

Details

Input

Input consists of

  • an positive integer (named value) that is less than 20 (read in via input)

Processing

You will need declare and initialize the following integer variables:

  • tens: number of ten dollar bills required.
  • fives: number of five dollar bills needed (after tens are paid towards value)
  • toonies: number of two dollar coins needed (after tens and fives are paid)
  • loonies: number of one dollar coins needed (after tens, fives and toonies are paid)

Output

While output is taken care of for you, it requires the integer variables described above for it to work properly.

 

Sample input/output:

Input Output

19

1 $10 bills

1 $5 bills

2 toonies

0 loonies

I Exit Full Screen pod2.py New * BULLITUN. :: 6 value = int(input) 10 # PLEASE START YOUR WORK HERE # 11 EEE===== 12 14 #Calc

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#get user input
value = int(input("Enter an integer value(less than 20): "))

#calculate the number of ten, five, toonies and loonies
tens = int(value / 10)
value = value % 10
fives = int(value / 5)
value = value % 5
toonies = int(value / 2)
value = value % 2
loonies = value

#display the result
print("\nThe combination of ten, five, toonies and loonies is given below:")
print( tens, "$10 bills")
print( fives, "$5 bills")
print( toonies, "toonies")
print( loonies, "loonies")

The screenshot of the above source code is given below:

#get user input value = int(input(Enter an integer value(less than 20): )) #calculate the number of ten, five, toonies and

OUTPUT:

Enter an integer value(less than 20): 19 The combination of ten, five, toonies and loonies is given below: 1 $10 bills 1 $5 b

Add a comment
Know the answer?
Add Answer to:
Instructions You will be given an integer value less than 20. Based on the number given,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You work at a bank and needs to automate the bills that are given to a...

    You work at a bank and needs to automate the bills that are given to a customer when they cash a check. When the check is cashed, the system should automatically break down the dollar amount into the smallest number of $20, $10, $5, and $1 bills. Specifications: Write a program that prompts the user to enter a U.S dollar amount and then shows how to pay the customer using the smallest number of bills. After the program runs, prompt...

  • Help with c please Much to the government's dismay, people in the U.S. prefer paper money...

    Help with c please Much to the government's dismay, people in the U.S. prefer paper money to coins. The U.S. Treasury has spent considerable time and effort trying to get people to adopt a $1 coin, but people just don't care for them. Obviously, part of the reason is that coins weigh more than paper money. The question is how much more? This project has you enter the number of paper bills you have in your wallet (twenties, tens, fives...

  • write a PHP program makes change for a given number of cents. The program should ask...

    write a PHP program makes change for a given number of cents. The program should ask the user for the amount of cents and then output the change for specific denominations of ten dollar bills, five dollar bills, one dollar bills, quarters, dimes, nickels, and pennies. Here is a sample program output for an input of 265 cents: Change for 2 dollars and 65 cents : 0 ten dollar bills 0 five dollar bills 2 one dollar bills 2 quarters...

  • I can't figure out which part of this assignment I am getting wrong. Any help would...

    I can't figure out which part of this assignment I am getting wrong. Any help would be appreciated thank you. A cashier distributes change using the maximum number of five-dollar bills, followed by one-dollar bills. Write a single statement 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) amount_to_change = int(input) WNE 1 test passed 3...

  • Given a value V in cents, you need to make change using a minimum number of...

    Given a value V in cents, you need to make change using a minimum number of coins. Assume you have an infinite supply of quarters, nickels, dimes, and pennies. Find the minimum number of coins. Display the quantity of each coin and the total number of coins, similar to the example output below. Use global constant identifiers, of type unsigned int, for the values of quarters, nickels, dimes, and pennies. Example: const unsigned int QUARTER = 25: Do not use...

  • Write a program “hw4.c” that reads integer (less than or equal 100) from the keyboard and,...

    Write a program “hw4.c” that reads integer (less than or equal 100) from the keyboard and, on the output, writes the sum of the divisors of n (other than itself). For integers less than or equal to 1 it should print 0. For example, the input -3 0 1 4 5 6 12 should generate the output 0 0 0 3 1 6 16 Explanation of output: The input -3 is less than 1, output is 0. The input 0...

  • in C please! Proiect Overview: A business owner is unhappy with the services provided by the...

    in C please! Proiect Overview: A business owner is unhappy with the services provided by the government and has chosen to pay the tax using a combination of coins including quarters, dimes, nickels, and pennies. In this project, you are asked to write a program to analyze the tax payment in coins. Th nickels and pennies the owner has paid. It then computes the total amount of tax paid in dollars and cents, and computes the weight of all the...

  • // demonstrates separating digits with a remainder operator // Mikhail Nesterenko // 01/22/2016 #include <iostream> using...

    // demonstrates separating digits with a remainder operator // Mikhail Nesterenko // 01/22/2016 #include <iostream> using std::cin; using std::cout; using std::endl; int main(){ cout << "Input number from 01 to 50: "; int number; cin >> number; const int singles = number % 10; const int tens = number / 10; cout << "tens: " << tens << endl; cout << "singles: " << singles << endl; You may assume that the user never inputs a number less than 1...

  • C++ HW Question Your program will simulate a simple change maker for a vending machine. It...

    C++ HW Question Your program will simulate a simple change maker for a vending machine. It will start with a stock of coins and dollars. It will then repeatedly request the price for an item to be purchased or to quit. If given a price, it will accept nickels, dimes, quarters, one-dollar and five-dollar bills—deposited one at a time—in payment. When the user has deposited enough to cover the cost of the item, the program will calculate the coins to...

  • Description For this program, you are going to convert decimal (integer) numbers into their octal number...

    Description For this program, you are going to convert decimal (integer) numbers into their octal number (integer) equivalents. Make sure that you create a new Project and Java class file for this assignment. Your Repl.It file should be named “Main.java”. You can read about octal-to-decimal number conversions from wikepedia or another website Instructions The input to the program will be a single non-negative integer number. If the number is less than or equal to 2097151, convert the number to its...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT