1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
#include <iostream>
using namespace std;
//Function Declarations
float getLoanPayment();
float getInsurance();
float getGas();
float getOil();
float getTires();
float getMaintenance();
float totalMonthlyCosts();
float totalAnnualCosts();
void showResult(float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost);
float calculateTotalMonthlyCosts(float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost);
int main() // start of the main function
{
//Declare and Initialze Variables
float loanPaymentCost = 0;
float insuranceCost = 0;
float gasCost = 0;
float oilCost = 0;
float tiresCost = 0;
float maintenanceCost = 0;
// Loan Payment Cost
loanPaymentCost = getLoanPayment();
//Get Insurance Cost
insuranceCost = getInsurance();
//Get Gas
gasCost = getGas();
// Get Oil Cost
oilCost = getOil();
// Get Tires Cost
tiresCost = getTires();
// Get Maintenance Cost
maintenanceCost = getMaintenance();
// Display results
showResult(loanPaymentCost, insuranceCost, gasCost, oilCost, tiresCost, maintenanceCost);
// Calculate toal Monthly costs
totalMonthlyCosts(loanPaymentCost, insuranceCost, gasCost, oilCost, tiresCost, maintenanceCost);
char quitKey;
//Delay
cout << "Press any key and Enter to end program: ";
cin >> quitKey;
//End of Program
return 0;
}
// Function to get Loan Payment Cost
float getLoanPayment()
{
float loanPaymentCost;
cout << "Enter the Loan Payment Cost and press ENTER" << endl;
cin >> loanPaymentCost;
//return result
return loanPaymentCost;
}
// Function to get Insurance Cost
float getInsurance()
{
float insuranceCost;
cout << "Enter the Insurance Cost and Press Enter" << endl;
cin >> insuranceCost;
//return result
return insuranceCost;
}
// Function to get Gas Cost
float getGas()
{
float gasCost;
cout << "Enter the gas cost and Press Enter" << endl;
cin >> gasCost;
// return result
return gasCost;
}
// Function to get Oil cost
float getOil()
{
float oilCost;
cout << "Enter the oil cost and press Enter" << endl;
cin >> oilCost;
// return result
return oilCost;
}
// Function to get Tires Cost
float getTires()
{
float tiresCost;
cout << " Enter the tire cost and press Enter" << endl;
cin >> tiresCost;
// return result
return tiresCost;
}
// Function to get Maintenance cost
float getMaintenance()
{
float maintenanceCost;
cout << " Enter the maintenance cost and press Enter" << endl;
cin >> maintenanceCost;
// return result
return maintenanceCost;
}
void showResult(float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost)
{
//Display all the purchase amount, state tax, county tax, total tax, and total of sale
cout << "Loan Payment Cost= " << loanPaymentCost << endl;
cout << "Insurance Cost = " << insuranceCost << endl;
cout << "Gas Cost = " << gasCost << endl;
cout << "Oil Cost = " << oilCost << endl;
cout << "Tires Cost = " << tiresCost << endl;
cout << "Maintenance Cost= " << maintenanceCost << endl;
}
float calculateTotalMonthlyCosts(float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost)
{
float totalMonthlyCost;
float totalMonthlyCost (float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost)
}
|