Assignment 7 — multi-input problem solving
Due time: Thursday, September 8
Download
Program all_consuming.py
- Develop a program that estimates annual consumption of a commodity based on how much is consumes on both a typical weekday and on a typical weekend day.
Assumptions
- The term week denotes 5 weekdays and 2 weekend days.
- Assume a year is exactly 52 weeks (yes, we know a real year is longer, but we will ignore that in this program).
- User supplied inputs are integers.
Requirements
- The program prompts the user for the commodity to analyze.
- The program then individually (i.e., separarely) prompts the user for two integer values:
- First, the quantity consumed on a typical weekday,
- Then the quantity consumed on a typical weekend day.
- The program uses the inputs to compute and report the estimate of the quantity consumed in a year.
- The quantity output should specify the commodity whose use is being reported.
Suggested agorithm
- Get input commodity of interest
- Get weekday consumption
- Get weekend day consumption
- Compute weekly consumption
- Compute yearly consumption
- Report yearly consumption
Three program runs
What is something you consume daily? paper napkins
How much consumed on a typical weekday: 6
How much consumed on a typical weekend day: 0
You consume 1560 paper napkins per year.
What is something you consume daily? pretzels
How much consumed on a typical weekday: 0
How much consumed on a typical weekend day: 1
You consume 104 pretzels per year.
What is something you consume daily? jelly beans
How much consumed on a typical weekday: 4
How much consumed on a typical weekend day: 12
You consume 2288 jelly beans per year.