Create a program that calculates your daily driving cost, so that you can estimate how much money could be saved by carpooling (car-sharing), which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The program should input the following information and display the user’s cost per day of driving to work:
a) Total miles driven per day.
b) Cost per gallon of gasoline.
c) Average miles per gallon.
d) Parking fees per day.
#include<iostream>
using namespace std;
void display(){
cout<<"TOTAL MILES PER DAY"<<endl;
int miles;
cin>>miles;
cout<<"enter fuel"<<endl;
int fuel;
cin>>fuel;
cout<<"Enter parking fee"<<endl;
double fees;
cin>>fees;
cout<<"Average miles per gallion day "<<miles/fuel<<endl;
cout<<"total cost per day "<<miles*fuel+fees<<endl;
}
int main(){
display();
return 0;}
Comments
Leave a comment