In: Computer Science
#include <iostream>
using namespace std;
// function to compute monthly cost
double monthly_cost(double loan,double Insurance,double Gas,double Oil,double Tires,double Maintenance)
{
double cost = loan+Insurance+Gas+Oil+Tires+Maintenance;
return cost;
}
int main() {
//variable declaration
double loan,Insurance,Gas,Oil,Tires,Maintenance;
//user input
cout<<"Enter monthly cost for loan:\n";
cin>>loan;
cout<<"Enter monthly cost for insurance:\n";
cin>>Insurance;
cout<<"Enter monthly cost for gas:\n";
cin>>Gas;
cout<<"Enter monthly cost for oil:\n";
cin>>Oil;
cout<<"Enter monthly cost for tires:\n";
cin>>Tires;
cout<<"Enter monthly cost for maintenance:\n";
cin>>Maintenance;
//calculate total monthly cost
double total_monthly_cost = monthly_cost(loan,Insurance,Gas,Oil,Tires,Maintenance);
//calculate total monthly cost
double total_annually_cost = total_monthly_cost*12;
//print output
cout<<"\nTotal Monthly cost for expenses incurred from operating his or her automobile is: "<<total_monthly_cost;
cout<<"\n\nTotal Annual cost for expenses incurred from operating his or her automobile is: "<<total_annually_cost;
}
Output::
Note/:: If you have any queries Comment I will solve anything