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
|
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
float calclivingexpen(float);
float calcmonthlypay(float, float);
float calcsavings(float, float, float, float);
void displayOutput(float, float, float, float, float, float, float);
// End Prototypes
int main ()
{
//Local Declarations
float idnumber, numfamily, income, totaldebt, expecliving, monthlypay, savings;
// Program Input data
cout << "Enter Id Number: ";
cin >> idnumber;
cout << "Enter Number of family members: ";
cin >> numfamily;
cout << "Enter Amount of Income: ";
cin >> income;
cout << "Enter Total Debt Amount: ";
cin >> totaldebt;
calclivingexpen(numfamily);
calcmonthlypay(monthlypay, totaldebt);
calcsavings(savings, numfamily, income, totaldebt);
displayOutput(idnumber, numfamily, income, totaldebt, expecliving, monthlypay, savings);
return 0;
}
// End Main
float calclivingexpen(float numfamily)
{
// Local Declarations
const float perperson = 50000.00;
float expecliving;
expecliving = (numfamily * perperson);
return expecliving;
}
float calcmonthlypay(float monthlypay, float totaldebt)
{
monthlypay = (totaldebt/12);
return monthlypay;
}
float calcsavings(float savings, float famsize, float income, float totaldebt)
{
savings = (famsize * 0.02) * (income - totaldebt);
return savings;
}
void displayOutput(float idnumber, float numfamily, float income, float totaldebt, float expecliving, float monthlypay, float savings)
{
// Program statements
cout << "The id number is: " << idnumber << endl;
cout << "The number of family is: " << numfamily << endl;
cout << "The total income is: " << income << endl;
cout << "The total debt is: " << totaldebt << endl;
cout << "The expected living is: " << expecliving << endl;
cout << "The monthly payment is: " << monthlypay << endl;
cout << "Savings is: " << savings << endl;
return;
}
|