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
|
#include <iostream> // for cout, endl
#include <string>
using namespace std;
//Function Prototypes
void Getinput(int& Loantype, float& Income, float& Totaldebt, float& Loanamount);
void Autoloan(float& Income, float& Totaldebt, float& Loanamount, string Eligible);
void Mortgage(float& Income, float& Totaldebt, float& Loanamount, string Eligible);
void Printreport(int& Loantype, float& Loanamount, string Eligible);
void main ()
{
int Loantype;
float Income, Totaldebt, Loanamount;
while(Loantype != 3)
{Getinput(Loantype, Income, Totaldebt, Loanamount);
if(Loantype == 1);
{Autoloan (Income, Totaldebt, Loanamount, Eligible);
Printreport (Loantype, Loanamount, Eligible);}
else
if(Loantype == 2);
{Mortgage (Income, Totaldebt, Loanamount, Eligible);
Printreport (Loantype, Loanamount, Eligible);
//*********************************************
void Getinput(int& Loantype, float& Income, float& Totaldebt, float& Loanamount);
{
cout << "Select one of the following options:" << endl << endl;
cout << " 1 Auto Loan" << endl;
cout << " 2 Home Mortgage Loan" << endl;
cout << " 3 Stop Program" << endl << endl;
cout << "Enter a number." << endl;
cin >> Loantype;
if (Loantype == 1 || Loantype == 2)
{cout << "Enter Income, Total Debt, and Loan Amount." << endl;
cin >> Income >> Totaldebt >> Loanamount;
}
}
//************************************************
void Autoloan(float& Income, float& Totaldebt, float& Loanamount, string Eligible);
{
if (Income - Totaldebt >= Loanamount * .5)
Eligible = true;
else Eligible = false;
}
//***********************************************
void Mortgage(float& Income, float& Totaldebt, float& Loanamount, string Eligible);
{
if (Income - Totaldebt >= Loanamount * .3)
Eligible = true;
else Eligible = false;
}
//***********************************************
void Printreport(int& Loantype, float& Loanamount, string Eligible);
{
if (Eligible = true);
cout << "Loan Type: " << endl;
cout << "Loan Amount: " << Loanamount << endl;
cout << "Eligible: Yes." << endl;
else
if (Eligible = false);
cout << "Loan Type: " << endl;
cout << "Loan Amount: " << Loanamount << endl;
cout << "Eligible: No." << endl;
}
}}
|