Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This lab should be done by every student. You can ask questions of the instructor or your TA. Do not ask other students. Due date:

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
This lab should be done by every student. You can ask questions of the instructor or your TA. Do not ask other students. Due date: - Submit the program .py with corrections and additions. Educational goals of this lab - verify that every student can - Use the Python IDE to work with a program in Python (cashier.py) - Document the errors in the program you encounter and fix them - Submit a program file to be graded using the icollege If the file is not timestamped by the end of the lab session, you get NO points! Submit your file to the I-college Dropbox. Saving Files: On your computer you can save a file where you wish, but it is a good idea to make at least one folder for your CS 1301 work, to make it easy to find. INSTRUCTIONS: - (100 points) Problem: Documenting errors; Getting a program to run On your machine, run your choice of Python IDE (IDE). Copy and paste the Python program below into a NEW FILE in the IDE editor of your choice. The program is everything between the two horizontal lines on the page. Save the program file as cashier.py. Purpose: calculate the change you are due when you buy an item in a store Pre-conditions (input): money given to the cashier (cost of item) Post-conditions (output): change user get back from the cashier(quarters, dimes, nickels and pennies) def main( ) : \# Design and implementation \# 1. Output a message to identify the program, and a blank line print("Conversion of change to quarters, dimes, nickels and pennies") print() \# 2. Input amount of money from user ant = float (input (A Amount of money given to cashier?: " ) ) \# 3. Calculate the change in quarters, dimes, nickles, pennies \# 4. Output resulting change and given cost of an item print() print( "change is converted to quarters = ", quarters) main() \# end of program file Demonstrating the Test Cases - After you fix the two bugs, it should run without errors and produce the correct output given in the test cases. - Here are three test cases for the program (after it is corrected). Your program, after you fix it, MUST produce the output of these cases correctly. NOTE: we will use these test cases to test your program when grading. When you have the program running correctly, make sure your TA or sees that you can run at least one of them. The italicized bold text is what the user types in while the program is running. Test Case 1: (user inputs are in italic and bold) - Conversion of change to dollars, quarters, dimes, nickels, pennies - Cost of an itemr 99 - Amount of money given to the cashier? 100 - change is converted to quartergmo, dimes=0, nickelsa0, pennies=1 Test Case 2: (user inputs are in italic and bold) The italicized bold text is what the user types in while the program is running. Test Case 1: (user inputs are in italic and bold) - Conversion of change to dollars, quarters, dimes, nickels, pennies - Cost of an item? 99 - Amount of money given to the cashier? 100 - Change is converted to quarters =0, dimes =0, nickels =0, pennies =1 Test Case 2: (user inputs are in italic and bold) - Conversion of change to dollars, quarters, dimes, nickels, pennies - Cost of an item? 157 - Amount of money given to the cashier? 300 - Change is converted to quarters =5, dimes =1, nickels=1, pennies =3 pennies=3 Test Case 3: (user inputs are in italic and bold) - Conversion of change to dollars, quarzers, dimes, nickels, pennies - cost of an item? 0 - Amount of money given to the cashierz 0 - change is converted to quarcers =9, dimes =2, nickezs=0, pernies =0 - Cost of an item? 157 - Amount of money given to the cashier? 300 - change is converted to quarters=5, dimes=1, nickels=1, pennies =3 Test Case 3: (user inputs are in italic and bold) - Conversion of change to dollars, quarters, dimes, nickels, pennies - Cost of an item? 0 - Amount of money given to the cashier? 0 - change is converted to quarters=0, dimes=0, nickels=0, pennies =0 pennies =0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions