forked from anooamogh/TeamA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
86 lines (78 loc) · 2.9 KB
/
Copy pathPerson.java
File metadata and controls
86 lines (78 loc) · 2.9 KB
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
public class Person {
public boolean buyHouse;
public String whatToDo;
public boolean[] denialReason = new boolean[5];
private int creditScore;
private int monthlyIncome;
private int creditCardPayment;
private int studentLoanPayment;
private int appraisedValue;
private float loanAmount;
private float monthlyMortgagePayment;
private int carPayment;
private float downPayment;
public Person() {
}
public Person(int monthlyIncome, int creditCardPayment, int carPayment, int studentLoanPayment, int appraisedValue, float downPayment, float loanAmount, float monthlyMortgagePayment, int creditScore) {
this.monthlyIncome = monthlyIncome;
this.creditCardPayment = creditCardPayment;
this.carPayment = carPayment;
this.studentLoanPayment = studentLoanPayment;
this.appraisedValue = appraisedValue;
this.downPayment = downPayment;
this.loanAmount = loanAmount;
this.monthlyMortgagePayment = monthlyMortgagePayment;
this.creditScore = creditScore;
this.buyHouse = true;
this.whatToDo = "";
this.denialReason = new boolean[]{false, false, false, false, false};
this.checkCreditScore();
this.checkDebtToIncomeRatio();
this.checkLoanToValue();
this.checkFrontEndDebtToIncome();
}
private void checkLoanToValue() {
float result = 1 - (float) ((downPayment * 1.0) / appraisedValue);
if (result >= .8) {
whatToDo = whatToDo + "Increase down payment. ";
buyHouse = false;
denialReason[0] = true;
return;
}
}
private void checkDebtToIncomeRatio() {
float debt = carPayment + creditCardPayment + monthlyMortgagePayment + studentLoanPayment;
float cdiRatio = (float) (debt) / monthlyIncome;
float mortgageDTI = (float) (monthlyMortgagePayment) / monthlyIncome;
if (0.28 < mortgageDTI) {
buyHouse = false;
denialReason[4] = true;
whatToDo = whatToDo + "Look for lower price house. ";
return; // more than 28% of that debt is going towards servicing a mortgage
}
if (cdiRatio > 0.36) {
buyHouse = false;
denialReason[1] = true;
whatToDo = whatToDo + "Pay off loans. ";
return;
}
return;
}
private void checkFrontEndDebtToIncome() {
float fedtiRatio = (float) (monthlyMortgagePayment) / monthlyIncome;
if (fedtiRatio > 0.28) {
denialReason[2] = true;
whatToDo = whatToDo + "Refinance mortgage. ";
buyHouse = false;
return;
}
}
private void checkCreditScore() {
if (creditScore < 640) {
denialReason[3] = true;
buyHouse = false;
whatToDo = whatToDo + "Raise credit score. ";
return;
}
}
}