CPSC 230 Programming Assignment 2: Conditionals solution




5/5 - (3 votes)

Chapter 2
The Assignment
Now that we are all familiar with if/else statements, your next assignment will
consist of incorporating error checking into your TotalPrice.py and Quadratic.py
modules. DO NOT use loops yet.
TotalPrice.py: Add if statements to check that the sale price and sales tax are valid
values, that is, not negative. If they are, prompt the user of their mistake. Your
program should only continue to ask for sales tax rate if the sale price is positive.
Quadratic.py: Add an if statement to check if the value of the discriminate is
negative. If the discriminate is negative prompt the user. Also, your program should
not continue with the square root calculation, hence avoiding the “math domain
Due Date
This assignment is due at 11:59 pm on 9-26-2020. Submit via Blackboard; create a
zip file with all your files in it. It should be labeled firstinitiallastname_Assignment2.
Please make sure to include all the required files (README, source files).
Assignments will be graded on correctness, adherence to style, and the inclusion of
meaningful comments.