CS 122 - Assignment 3
Instructions | Mastery | Challenge | Deliverables | Submit
ACME Widget Calculator: The ACME widget company manufactures widgets according to their customer's orders. Unfortunately, they frequently forget to ask for important details from their customers and they are lousy at calculating the total cost. This application walks through the ordering process, making sure all the required information is collected.
Here's my solution for this assignment. Note that as with all assignments, my version is not the only way to do it!
For the competency level: solution.py
For the mastery level: masterySolution.py
Posted Friday, August 7
Write a program that asks the user to enter some information about an order (see below for details), prints out the total cost, 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 repeat the whole thing as long as needed.
The program should collect the following bits of information
- How many widgets are in the order? (integers only)
- What is the brassafax ratio? (floating point number)
- What is the cromulence level? (floating point number)
- Add velocitators? (yes or no)
The program should then output the total cost and ask the user if they want to enter another order. The total cost is calculated as follows:
Here's what one sample run of the program looks like:
And here's what another sample run with multiple orders looks like:
Add file output to your program. When the program is run it should append to a file called "receipt.txt" all the information that was specified by the user as well as the total cost.
A sample receipt.txt might look like this:
Ask the user for the number of orders they want to specify, the loop through the questions for each order. Write each order to a different file, named "receipt1.txt", "receipt2.txt" and so on.
Submit your python file implementing the widget calculator
This assignment is due Thursday, July 30th, at 7:00 am