when run, program is skipping over cin statements where data should be entered
Code:
/*
Programmer: Joe Difilippo
Userid: Jdifilip
Section: 091
Assignment: Program 2
Purpose: This program determines whether or not an applicant qualifies to receive a home loan based on his/her ability to repay a mortgage.
*/
#include <iostream>
using namespace std;
int main()
{
int house;
double downPayment;
char county;
int age;
char military;
double annualLoan;
double annualPropertyTax;
const double INTEREST_RATE = .05;
int Insurance;
double annualIncome;
double monthlyOtherDebt;
double yearlyOtherDebt;
double annualDebt;
double annualHouseLoan;
char Mecklenburg;
char Cabarrus;
double annualPrivateMortgage;
double annualBaseLoan;
char yes;
cout << "How much is the desired house? " << endl;
cin >> house;
if (house >= 50000) {
Insurance = (house % 50000) * 250;
}
else {
if (house < 50000) {
Insurance = 250;
}
}
cout << "How much will you pay up front? " << endl;
cin >> downPayment;
if (downPayment < (.2 * house)) {
annualPrivateMortgage = 1.12 * annualLoan;
}
else {
if (downPayment >= (.2 * house)) {
annualPrivateMortgage = 1 * annualLoan;
}
}
cout << "Do you live in Mecklenburg or Cabarrus county? " << endl;
cin >> county;
if (county = Mecklenburg) {
annualPropertyTax = .015 * house;
}
else {
if (county = Cabarrus) {
annualPropertyTax = .012 * house;
}
}
cout << "How old are you? " << endl;
cin >> age;
cout << "Are you currently in the military? (Enter yes or no)" << endl;
cin >> military;
cout << "What is your annual gross income? " << endl;
cin >> annualIncome;
cout << "How much do you pay each month for other debt? " << endl;
cin >> monthlyOtherDebt;
if ((county = Cabarrus) && (age > 65 || military = yes)) {
annualPropertyTax = (annualPropertyTax * .998);
}
yearlyOtherDebt = monthlyOtherDebt * 12;
annualHouseLoan = house/20;
annualBaseLoan = (Insurance + annualPropertyTax + annualHouseLoan);
annualLoan = (annualBaseLoan * annualPrivateMortgage) + (annualBaseLoan * INTEREST_RATE);
annualDebt = yearlyOtherDebt + (annualBaseLoan * annualPrivateMortgage) + (annualBaseLoan * INTEREST_RATE);
if ((annualIncome / annualDebt) <= .28) {
cout << "Your debt to income ratio is: $ " << (annualIncome / annualDebt) << endl;
cout << "You qualify for mortgage." << endl;
}
else {
if ((annualIncome / annualDebt) > .28) {
cout << "Your debt to income ratio is: $ " << (annualIncome / annualDebt) << endl;
cout << " You do not qualify for mortgage." << endl;
}
}
return 0;
}