Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Purpose of this assignment: The purpose of this assignment is to understand Inpu

ID: 3670679 • Letter: P

Question

Purpose of this assignment: The purpose of this assignment is to understand Input, Processing,and integer calculation and selection statement which are covered in Chapter 2 and 3. Problem Statement: Write a program that tells what coins to give out for any ameunt ofc atement: Write a program that tells what coins to give out for any ameunt of change from 1 cent to 99 cents. Use coin denominations of 25 cents for quarter, 10 cents for dime, 5 cents for nickel, and 1 cent for penny. Do not use half-dollar coins. Following shows a few example outputs of program runs. Sample Outputs: SAMPLE RUN #1 SAMPLE RUN #2 Welcome to the coin change machine. Please enter the change amount: 86 86 cents can be given as Welcome to the coin change machine. Please enter the change amount: 69 69 cents can be given as 3 quarter 1 dime 1 penny 2 quarter 1 dime 1 nickel 4 penny Thank you for using our system Thank you for using our system. SAMPLE RUN #4 SAMPLE RUN 3 Welcome to the coin change machine. Please enter the change amount: 26 26 cents can be given as Welcome to the coin change machine Please enter the change amount: 20 20 cents can be given as 2 dime 1 quarter 1 penny Thank you for using our system. Thank you for using our system. SAMPLE RUN #S Welcome to the coin change machine. Please enter the change amount: 8 8 cents can be given as 1 nickel 3 penny Thank you for using our system. Notice if a unit has value 0, that unit does NOT show. Remember to never change the default password for your class account, nor share it! OLA assignments are to be done on your own, on your own time. Help may only come from your instructor, your lab assistant, the help desk workers (hours are posted on KOM 363), NOT from other students. Remember, OLA assignments are 1 5% of your grade and you must not miss three or more to get C or better. assignments are not allowed, ment to a failing grade for the collaboration will range from a grade of zero for an individual assig course,

Explanation / Answer

# This program takes input 1 to 99 fro user and tell what coin to give out of any aount of change
# Program uses denominations 25-quarter, 10-dime, 5-Nickel, 1-penny
def change(amount):
    num = amount/25
    if num != 0 :
        print num," quarter ",
    amount = amount % 25;
    num = amount/10
    if num != 0 :
        print num," dime ",
    amount = amount % 10;
    num = amount/5
    if num != 0 :
        print num," nickel ",
    amount = amount % 5;
    if amount != 0 :
        print amount," penny"
    return

print "*************************************************************************"
print "Welcome to the coin change machine."
print "*************************************************************************"
amount = input("Please enter the change amount: ")
print
print
print amount," cents can be given as"
change(amount)
print
print "Thank you for using our system"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote