Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment 2 Write a program that displays change due back to a customer. The program should prompt user to enter total pennies as the change
Assignment 2 Write a program that displays change due back to a customer. The program should prompt user to enter total pennies as the change due back to a customer and then it will display total pennies in the form of quarters, dimes, nickels, and pennies. For instance, if user enters 97 pennies, the program should display 3 quarters, 2 dimes, 0 nickel, and 2 pennies. To Solve this problem, we can identify IPO and develop the Pseudocode. Input Total pennies to convert, in this case, we use 97 pennies Processing To convert the given pennies to quarters, dimes, nickels, and pennies in this order. Output Display the result for each coin denomination. Variables total_pennies, remaining_pennies, quarters, dimes, nickels - all are integer type Constants PENNY TO QTR = 25, PENNY TO DIME = 10, PENNY TO NICKEL = 5 Detail 1. Prompt the user to enter total pennies. Pseudocode 2. Convert to quarters first: quarters = total_pennies / PENNY_TO_QTR 3. Calculate the remaining pennies after you convert to quarter. Use the remaining pennies to get total dimes. 4. After dime conversion, figure out the remaining pennies again and then get total nickels. 5. Figure out the final remaining pennies. 6. Display quarters, dimes, nickels, and remaining pennies. Use the above pseudocode, you can map to Python code. Assignment Instructions: 1. Create a Python program and name it First_Last_A2.py. (First is your first name, and Last is your last name) 2. Submit your file in Canvas for grading 3. Name your variables clearly 4. Add comments to document your code 5. Program output is as follows: Program output: Enter total pennies: 97 Total pennies to convert: 97 Total Quarters: 3 Total Dimes: 2 Total Nickels: 0 Total Pennies: 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started