Assignment: #CommuteCalculator |
Due: 11/17/2017 |
Points: 5 |

This program calculates the cost of a commute. The calculation requires the following inputs.

- how many round-trip miles a day do you commute
- how many days a week do you commute
- how many weeks a year do you commute
- what is the gas mileage of your vehicle (i.e. miles per gallon)
- what is the current per gallon price of gas
Prompt the user to enter the aforementioned data and compute how much money per month is spent on gas.

Use

`int`

variables for all the data except for the price of gas -- use a`double`

to store that.The formula for this part is similar to the following:

- determine the milesPerYear

(milesPerDay multiplied by daysPerWeek multiplied by weeksPerYear)- determine gallonsPerYear

(milesPerYear divided by milesPerGallon)- determine gasMoneyPerYear

(gallonsPerYear times pricePerGallon)- determine monthlyGasExpense

(gasMoneyPerYear divided by the number of months in a year)

Note:Numbers enclosed in <`angle brackets`

> are user inputs. Your prompts should match those used in this example.How many miles round-trip a day do you commute? <22> How many days a week do you commute? <4> How many weeks a year do you commute? <39> How many miles per gallon does your vehicle get? <23> What is the current per gallon price of gas? <1.21>The program output for a single calculation should look as follows.

22 miles a day 4 days a week 39 weeks a year 23 miles per gallon $1.21 per gallon monthly gas expense: $15.0461Prompt the user if they'd like to do another cost of commute calculation. If they enter 'Y' or 'y', then repeat; otherwise, print the following and exit the program.

This program executed X cost of commute calculations. Total commute miles: Y Average commute cost: $zThe following is another example that doesn't include the prompts, but does include yearly data for each calculation.

22 miles a day 4 days a week 39 weeks a year 23 miles per gallong $1.21 per gallon monthly gas expense: $15.0461 (yearly miles: 3432; yearly cost: $180.553) Do another calculation ('Y' or 'y'): y 10 miles a day 5 days a week 50 weeks a year 25 miles per gallon $2.40 per gallon monthly gas expense: $20 (yearly miles: 2500; yearly cost: $240) Do another calculation ('Y' or 'y'): n This program executed 2 cost of communte calculations. Total commute miles: 5932 Average commute cost: $17.523