In [ ]:
# run this code to login to https://okpy.org/ and setup the assignment for submission
from ist256 import okclient
ok = okclient.Homework()

Now You Code 2: Paint Pricing

House Depot, a big-box hardware retailer, has contracted you to create an app to calculate paint prices.

The price of paint is determined by the following factors:

  • Everyday quality paint is $19.99 per gallon.
  • Select quality paint is $24.99 per gallon.
  • Premium quality paint is $32.99 per gallon.

In addition if the customer wants computerized color-matching that incurs an additional fee of $4.99 per gallon.

Write a program to ask the user to select a paint quality: 'everyday', 'select' or 'premium', prompt for color matching, and then outputs the price per gallon of the paint.

Example Run 1:

Which paint quality do you require ['everyday', 'select', 'premium'] ?select
Do you require color matching [y/n] ?y
Total price of select paint with color matching is $29.98

Example Run 2:

Which paint quality do you require ['everyday', 'select', 'premium'] ?premium
Do you require color matching [y/n] ?n
Total price of premium paint without color matching is $32.99

Step 1: Problem Analysis

Inputs:

Outputs:

Algorithm (Steps in Program):


In [1]:
# Step 2: Write code here

Step 3: Questions

  1. When you enter something other than 'everyday', 'select', or 'premium' what happens? Modify the program to print that is not a paint quality and then exit in those cases.

Answer:

  1. What happens when you enter something other than 'y' or 'n' for color matching? Re-write the program to print you must enter y or n whenever you enter something other than those two values.

Answer:

  1. Why can't we use Python's try...except in this example?

Answer:

  1. How many times (at minimum) must we execute this program and check the results before we can be reasonably assured it is correct?

Answer:

Step 4: Reflection

Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed? How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?

To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.

Keep your response to between 100 and 250 words.

--== Write Your Reflection Below Here ==--


In [ ]:
# to save and turn in your work, execute this cell. Your latest submission will be graded. 
ok.submit()