Write a program with total change amount as an integer input, and output the change using...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies Ex: If the input is: 0 (or less than 0), the output is: No change. Ex: If the input is 45 the output is: 1 Quarter Dimes 2 Instructor note: Keep in Mind • You should have as many larger coins as possible, so if the input is over 100, it should calculate dollar(s) first. You may not use dollar coins on a regular basis, but there is the Sacagawea dollar coin. • Keep single vs plural in mind. Usually just an 's" at the end, except for penny versus pennies Think about how you can use the floor division and modulo operators. Only print a coin type if it's part of the solution. For example, if the input is 55, then the output consists of quarters and nickels, but no dimes LAD ACTIVITY 1 money int(input()) 2 3 if money <- 8: 4 5 6 nickles - 0 7 pennies d 8 9 dollars money // 100 10 if dollars and money > 8: 11 12 13 14 . 2 Quarters • 1 Nickel 4.17.1: LAB: Exact change 36 37 38 39 40 print("No change") 45 46 noney money (dollars 180). 47 48 if dollars -- 1: print(dollars, 'Dollar'). 15 16 17 quarters money // 25 18 if quarters and money > 0: 19 20 21 22 23 24 elif dollars 1: print(dollars, 'Dollars') money money (quarters 25) if quarters - 1: print(quarters, 'Quarter') 25 dimes 26 if dines 27 28 29 elif quarters > 1: print(quarters, "Quarters') money // 10 @ and money 0: money money (dines 10) if dines - 1: 30 31 32 33 nickles 34 if nickles 35 print(dimes, 'Dine') elif pennies 1: print(dimes, 'Dines') money // S and money > 8: noney money (nickles 5) if nickles 1: print(nickles, "Nickel') elif pennies 1: 41 pennies- money // 1 42 if pennies and money > 0: 43 44 print(nickles, "Nickles'). noney money (pennies 1) if pennies 1: print (pennies, "Penny") elif pennies 1: print(pennies, 'Pennies'). main.py B/10 Load default template. Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies Ex: If the input is: 0 (or less than 0), the output is: No change. Ex: If the input is 45 the output is: 1 Quarter Dimes 2 Instructor note: Keep in Mind • You should have as many larger coins as possible, so if the input is over 100, it should calculate dollar(s) first. You may not use dollar coins on a regular basis, but there is the Sacagawea dollar coin. • Keep single vs plural in mind. Usually just an 's" at the end, except for penny versus pennies Think about how you can use the floor division and modulo operators. Only print a coin type if it's part of the solution. For example, if the input is 55, then the output consists of quarters and nickels, but no dimes LAD ACTIVITY 1 money int(input()) 2 3 if money <- 8: 4 5 6 nickles - 0 7 pennies d 8 9 dollars money // 100 10 if dollars and money > 8: 11 12 13 14 . 2 Quarters • 1 Nickel 4.17.1: LAB: Exact change 36 37 38 39 40 print("No change") 45 46 noney money (dollars 180). 47 48 if dollars -- 1: print(dollars, 'Dollar'). 15 16 17 quarters money // 25 18 if quarters and money > 0: 19 20 21 22 23 24 elif dollars 1: print(dollars, 'Dollars') money money (quarters 25) if quarters - 1: print(quarters, 'Quarter') 25 dimes 26 if dines 27 28 29 elif quarters > 1: print(quarters, "Quarters') money // 10 @ and money 0: money money (dines 10) if dines - 1: 30 31 32 33 nickles 34 if nickles 35 print(dimes, 'Dine') elif pennies 1: print(dimes, 'Dines') money // S and money > 8: noney money (nickles 5) if nickles 1: print(nickles, "Nickel') elif pennies 1: 41 pennies- money // 1 42 if pennies and money > 0: 43 44 print(nickles, "Nickles'). noney money (pennies 1) if pennies 1: print (pennies, "Penny") elif pennies 1: print(pennies, 'Pennies'). main.py B/10 Load default template.
Expert Answer:
Answer rating: 100% (QA)
Function to calculate the fewest coins needed for change def calculatechangecoins amount change Define the coin values in cents coinvalues Dollars 100 ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The housing foreclosure crisis has been particularly devastating in housing markets in much of the south and west United States, but even when analysis is restricted to relatively strong housing...
-
what are the comparisons between the Linux Kernel , Linux System , Linux Distributions , Linux Licensing ?
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
__________ is the process that occurs when a job applicant does research on an organization and concludes there is enough of a fit between themselves and a job opening to warrant submitting their...
-
If the planes of a crystal are 3.50 A (1 A = 10-10 m = 1 Angstrom unit) apart, (a) What wavelength of electromagnetic waves is needed so that the first strong interference maximum in the Bragg...
-
Define the function majority n as in Problem 9.24. Show that it may be computed with O(n) size circuits. Problem 9.24. Recall that you may consider circuits that output strings over {0,1} by...
-
What are the key dimensionless parameters? Integrate the equation to find an expression for \(\lambda / L\) as a function of dimensionless time. Is a steady state reached in this system?
-
The following information for Lesky Corporation covers the year ended December 31, 2010: Required Change this statement to a multiple-step format, as illustrated in this chapter. LESKY CORPORATION...
-
What is the network used for? What networking components can you see? Are there any networking components that you can't see? If so, what other networking components do you expect are involved behind...
-
1. What benefits do customers receive in return for the sacrifices they make when buying a membership at Planet Fitness? 2. How does this benefit-sacrifice ratio give Planet Fitness a competitive...
-
Three invoices for the amounts of $35,500, $26,000, and $41,450 were received on July 2, 2014, August 1, 2014, and August 24, 2014, respectively. If the payment terms are 3/7, 2/30, n/60, calculate...
-
A manufacturing company reports the following information. Raw materials inventory, ending Raw materials used Current Year $ 171,200 1,998,700 1 Year Ago 2 Years Ago $ 192,200 2,544,100 $ 199,200...
-
You find a 2 , 5 5 0 SF house that completely fits your needs - it is priced at $ 1 , 2 5 0 , 0 0 0 . You are a professional cost estimator who knows the local market for both land and homes. You...
-
Cost of completed job: Direct materials $15,500 Direct labor 21,000 Manufacturing overhead 16,800 Total cost $53,300 Unit cost ($53,300 2,000) $26.65 (a) On the basis of this data, answer the...
-
Write a program to play the rock-paper-scissors game. Two users take turns entering R, P, or S. The program then announces the winner, based on the rule that paper covers rock, rock breaks scissors,...
-
The Internet has become an extremely valuable business tool, but its also a huge distraction for workers on the job. Employees are wasting valuable company time by surfing inappropriate websites...
-
Find the inverse, if it exists, for the given matrix. 3 2 2 5 Find the inverse. Select the correct choice below and, if necessary, fill in the answer box to complete your OA. The inverse is (Type a...
-
In the figure, two loudspeakers, separated by a distance of d1 = 2.63 m, are in phase. Assume the amplitudes of the sound from the speakers are approximately the same at the position of a listener,...
-
Modify the algorithm shown earlier in Figure 1-5 so that it gives a 25% discount if the customer buying a TV is an employee of the store; all other customers buying a TV should receive a 15%...
-
In this exercise, you will modify the code from Exercise 10. If necessary, create a new project named ModifyThis11 Project, and save it in the Cpp8\Chap08 folder. Enter (or copy) the TryThis10.cpp...
-
Complete the C++ instructions column in Figure 3-25. The numbers of latex and Mylar balloons purchased will be integers. All of the remaining items will be real numbers. Use the int and double data...
-
What role does the HAL play in the platform?
-
If your logic analyzer is capable of on-the-fly disassembly, use it to display bus activity in the form of instructions, rather than simply 1s and 0s.
-
Draw UML state diagrams for device 1 and device 2 in a four-cycle handshake.
Study smarter with the SolutionInn App