Question: Research several car - pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be
Research several carpooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by carpooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the users cost per day of driving to work:
Toll road miles driven per day
Nontoll road miles driven per day
Cost per gallon of gasoline
Average miles per gallon
Parking fees per day
Tolls per mile.
However, if the number of toll road miles per day is zero do not prompt and input Tolls per mile.
Ex:
Enter toll road miles driven per day:
Enter nontoll road miles driven per day:
Enter cost per gallon of gasoline:
Enter average miles per gallon:
Enter parking fees per day:
Enter tolls per mile:
Daily Savings $
Note: use int data type for toll road miles per day and nontoll road miles per day and double for all other values.
To input double value use the method nextDouble of a Scanner.
This lab will require use of an if statement to conditionally execute the statements to input the tolls per mile. Use this if statement:
if tollRoadMiles
place the statements to be conditionally executed here
Of course use the variable name you have for toll road miles, if not named tollRoadMiles
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
