CS 115 Summer 2017,
Lab 3 :
Due in Thursday 6/22/17 in Lab
Educational goals of this lab - verify that every student can do the following:
- Get inputs from user
- Arithmetic operators
- Output operators
- typecasts for input of numbers
- Using Built-in Packages
INSTRUCTIONS:
- Problem: Calculating change
You need a program that will calculate the change you are due
when you buy an item in a store. You need to know how much the item
costs and how much money you gave the cashier.
The program reports how many dollars, quarters, dimes, nickels and
pennies that you get back.
In this lab, write a python program to calculate the change (dollars, quarters, dimes, nickels and
pennies) that the user get back from the cashier
- Run Examples
When you have the program running correctly, Verify that your program produces the same output as in the following test cases.
--- Test case 1 ---
Change calculator
Enter the price of the item bought: .99
Enter the amount of money you give the cashier: 1
Your change:
dollars 0
quarters 0
dimes 0
nickels 0
pennies 1
Thank you for your business
--- Test case 2 ---
hange calculator
Enter the price of the item bought: 1.57
Enter the amount of money you give the cashier: 3
Your change:
dollars 1
quarters 1
dimes 1
nickels 1
pennies 3
Thank you for your business
Program Prolog
# supply program prolog
# Prolog
# Author: Mary Smith
# Email: Mary.Smith@uky.edu
# Section: 00
# Date: 8/31/16
'''
Purpose: ....
Preconditions: ....
Postconditions: ....
'''
Requirments:
1- Your output should match the run examples above.
2- Make sure you document your program. Use good, multi-character, meaningful
identifiers (variables).
3- At the top of your program, you should have a prolog (name, date, etc.) and comments explaining different operations in your code.
4- Save the program file as cashier.py.
When you are done, show your program to the Instructor and then submit your file (cashier.py) as a submission for Lab 3 on CANVAS.