Additional Help
On this page you can find additional hints and help for if you get
stuck on the lab. We encourage you to use this information only
after giving the problem a few minutes of thought on your own.
Input, process, and output
Input, process, and output are the three basic components of any
program, no matter how small, how complicated, or how important. On
this page we will break this lab down into these three components
for you.
Input
Before you start, you'll first need to figure out a few things:
- How many miles is the trip one-way?
- You'll need to ask the user!
- How many days a week do they go to work?
The speed at which the user drives their car is assumed to be 57
MPH, and is a constant. This means that you don't need to ask for
it, and that the variable should be named using all capital letters
(and with underscores separating any words).
Process
To calculate the total commute per week, we also need some basic formulas:
- The number of miles driven in a week can be calculated as:
(one-way distance) * 2 * (number of days working)
- The number of hours spent per week in the car can be calculated as:
(total miles driven per week) / (miles per hour)
Output
At the end, you'll want to display two things to the user:
- The number of miles driven in a typical week
- The number of hours spent in the car in a typical week
Make sure to tell the user what the numbers mean — don't just
display them, place them in a descriptive sentence!