Wednesday, September 7, 2016

// // Leave a Comment

Car-Pool Savings Calculator In C

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:
  1. Total miles driven per day.
  2. Cost per gallon of gasoline.
  3. Average miles per gallon.
  4. Parking fees per day.
  5. Tolls per day.
/* 
 * Author: AGHATISE OSAZUWA
 * Website: www.cscprogrammingtutorials.com
 *
 * Program to calculate car daily driving cost (Car-Pool Savings Calculator)
 *
 */

#include <stdio.h>
int main ( ){ 
    int milesPD, costPG, avgMPG, pFeesPD, tollsPD;
    printf("Enter total miles driven per day: ");
    scanf("%d", &milesPD);
    printf("Enter cost per gallon of gasoline: ");
    scanf("%d", &costPG);
    printf("Enter average miles per gallon: ");
    scanf("%d", &avgMPG);
    printf("Enter parking fees per day: ");
    scanf("%d", &pFeesPD);
    printf("Enter tolls per day: ");
    scanf("%d", &tollsPD);
    system("pause");
    return 0;
}
Click here to see other solutions to Deitel C How To Program exercises | Click here to see the same program in Java.

0 comments:

Post a Comment


DISCLAIMER: Opinions expressed in comments are those of the comment writers alone and does not reflect or represent the views of the post author. We reserve the right to delete any post deemed inappropriate or offensive and/or spammy. Please do not use abusive words/hate speech.

I Appreciate your valuable Feedback. So, Please DO NOT SPAM - Spam comments will be deleted immediately.

Don't use brand name in name field and you're not allowed to use links in comments unless it's necessary. Such comments will be removed immediately.

Thanks.