CIS 122 Assignment 2

The ACME company manufactures glass windows (among other things) according to their customer's orders. Unfortunately, they've been losing money due to a flaw in their business practice, they'll start making windows before ensuring they have enough glass on hand to complete the order. Your job is to write a program that calculates how much glass is required to fill a given order, and display that to the user.

Instructions

Write a program that asks the user to enter some information about an order (see below for details), prints out the amount of glass required, then asks the user whether they want to enter another order.

You'll need to use the raw_input function to ask the user for their input, type conversion to get what they enter to the correct type so you can do some math with it, an if statement to ask if they want to continue, and a while loop to the whole thing repeating

Input

This program needs to ask the user for the following information

  • the number of windows in the order (integers only)
  • the height of each window (can be a floating point value)
  • the width of each window (can be a floating point value)
  • the thickness of each window (can be a floating point value)
It should then ask the user if they want to enter another order, and then repeat the process if they answer "yes".

Important: you don't need to validate the users input. If you ask them to enter "how many windows" and they type "qwijybo", then your program will die when you try to convert that to an integer. That's okay for this assignment. For now, we're assuming that the user will enter things correctly.

Output

The output of your program should match the examples below as closely as possible. Use the same prompts and try to get the spacing correct (but if you can't get the spacing right, don't sweat it too much).

Here's what one sample run of the program looks like:

How many windows in this order?      10
How wide is each window in inches?   24 
How tall is each window in inches?   10 
How thick is each window in inches?  0.333
This order will require 799.2 cubic inches of glass

Do you want to enter another order (yes or no)? no
Thanks for using the ACME glass calculator!
                

And here's another (longer) sample run:

How many windows in this order?      100
How wide is each window in inches?   4.5
How tall is each window in inches?   3.5
How thick is each window in inches?  1
This order will require 1575.0 cubic inches of glass

Do you want to enter another order (yes or no)? yes
How many windows in this order?      17
How wide is each window in inches?   39
How tall is each window in inches?   63
How thick is each window in inches?  2
This order will require 83538.0 cubic inches of glass

Do you want to enter another order (yes or no)? yes
How many windows in this order?      20
How wide is each window in inches?   1
How tall is each window in inches?   1
How thick is each window in inches?  1
This order will require 20.0 cubic inches of glass

Do you want to enter another order (yes or no)? no
Thanks for using the ACME glass calculator!
                

Extra credit

If this assignment is easy for you, here are some extra credit ideas. Do not try the extra credit unless your basic version is working perfectly! Extra credit won't add points to your basic grade, it might bump you up a bit at the end of the term, but if you can do the extra credit, you're probably already getting an A.

(A) Have the user enter the width and height in feet, and the thickness in inches. Give the resulting volume in cubic inches

(B) Ask the user what units they want to use before they enter their order. Validate that they enter a supported unit type (I suggest inch, feet, mm, cm) then display the results for that unit. If you're really ambitious, you could let them specify different units for each measurement and convert them to a standard before displaying the results.

Make sure you specify in the notes field if you did one of the extra credit options.

Deliverables

Submit your python program via the submit form at the bottom of this page.

This assignment is due Thursday, June 26th at 5:00pm.

Use the submit form at the bottom of this page to turn in your work.

Submit

Use this form to submit your completed assignment. If you submit it once and then find a mistake and want to submit it again, you can. You can submit as many versions as you'd like and I'll generally only look at the last one.

What is your student #?
What is your name?
What is your email?
Notes about this assignment:
Use the notes field to mention if you worked in a group or got help with any part of the assignment. Also note if something doesn't work correctly, it shows that you know about the problem. If you don't mention it, I'll assume you didn't test your code, and thus will grade you more harshly.
What file would you like to submit?
This assignment only requires you to turn in one file. If you think you need to turn in more than one, let me know about it and we'll figure out why.

The only acceptable file type to turn in for this assignment is the source code to your program (your .py file).


U of O | CIS | Questions? Ask me!