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 saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:
- Total miles driven per day.
- Cost per gallon of gasoline.
- Average miles per gallon.
- Parking fees per day.
- Tolls per day.
1 2 |
/* <br /> * Author: AGHATISE OSAZUWA<br /> * Website: www.cscprogrammingtutorials.com<br /> *<br /> * Program to calculate car daily driving cost (Car-Pool Savings Calculator)<br /> *<br /> */<br /><br />#include <stdio.h><br />int main ( ){ <br /> int milesPD, costPG, avgMPG, pFeesPD, tollsPD;<br /> printf("Enter total miles driven per day: ");<br /> scanf("%d", &milesPD);<br /> printf("Enter cost per gallon of gasoline: ");<br /> scanf("%d", &costPG);<br /> printf("Enter average miles per gallon: ");<br /> scanf("%d", &avgMPG);<br /> printf("Enter parking fees per day: ");<br /> scanf("%d", &pFeesPD);<br /> printf("Enter tolls per day: ");<br /> scanf("%d", &tollsPD);<br /> system("pause");<br /> return 0;<br />}<br /> |
Click here to see other solutions to Deitel C How To Program exercises | Click here to see the same program in Java.