In: Computer Science
Write a program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost of these expenses, and the total annual cost of these expenses.
Using the following test data:
310.34
104.95
78.34
12.34
8.12
45.00
Your output should look like this:
Enter the monthly loan payment amount:
Enter the monthly cost of insurance:
Enter the monthly cost of gas:
Enter the monthly cost of oil:
Enter the monthly cost of tires:
Enter the monthly cost of maintenance:
The total monthly cost is $559.09.
The total annual cost is $6709.08.
This is C++ and use visual studio 2017 please.
Use blank lines to separate the major parts of your main function. And show your output.
//################### PGM START ########################################
#include<iostream>
using namespace std;
//main method
int main(){
//varibles to hold different values
double loan;
double insurance;
double gas;
double oil;
double tries;
double maintenance;
double monthly;
double yearly;
//requesting loan amount from user
cout<<"Enter the monthly loan payment
amount:";
cin>>loan;
//requesting insurance amount from user
cout<<"Enter the monthly cost of
insurance:";
cin>>insurance;
//requesting gas amount from user
cout<<"Enter the monthly cost of gas:";
cin>>gas;
//requesting oil cost from user
cout<<"Enter the monthly cost of oil:";
cin>>oil;
//requesting cost for tries
cout<<"Enter the monthly cost of tires:";
cin>>tries;
//requesting cost for maintenance
cout<<"Enter the monthly cost of
maintenance:";
cin>>maintenance;
//calculating the monthly cost
monthly=loan+insurance+gas+tries+maintenance+oil;
//claculating the yearly cost
yearly=12*monthly;
//pdisplaying the results
cout<<"\nThe total monthly cost is
$"<<monthly<<"\n";
cout<<"The total annual cost is
$"<<yearly<<"\n";
return 0;
}
//##################### PGM END ####################################
OUTPUT
########
ClUsersIBM_ADMIN Desktop MAIN _FOLDERVoblPGMs\AutomobileCharge.exe Enter the monthly loan payment amount: 310.34 Enter the monthly cost of insurance 104.95 Enter the monthly cost of gas: 78.34 Enter the monthly cost of oil: 12.34 Enter the monthly cost of tires: 8.12 Enter the monthly cost of maintenance 45.00 The total monthly cost is $559.09 The total annual cost is $6709.08 Process exited after 26.05 seconds with return value 0 Press any key to continue . .