Repository navigation
Expand file tree
/
Copy pathLoanSystem.java
More file actions
81 lines (76 loc) · 2.88 KB
/
Copy pathLoanSystem.java
File metadata and controls
81 lines (76 loc) · 2.88 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
import java.util.*;
public class LoanSystem {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
System.out.println("Credit score: ");
int creditSccore = scn.nextInt();
scn.nextLine();
System.out.println("Employement Status: ");
String employement = scn.nextLine();
System.out.println("Annual İncome: ");
double income = scn.nextDouble();
System.out.println("Loan Amount: ");
double loanamount = scn.nextDouble();
scn.nextLine();
System.out.print("Loan Purpose: ");
String purpose = scn.nextLine();
System.out.print("Existing Debts: ");
double debts = scn.nextDouble();
boolean eligible = true;
if (purpose.equals("Home") && creditSccore < 700) {
eligible = false;
} else if (purpose.equals("Car") && creditSccore < 650) {
eligible = false;
} else if (purpose.equals("Education") && creditSccore < 600) {
eligible = false;
} else if (purpose.equals("Business") && creditSccore < 680) {
eligible = false;
} else if (purpose.equals("Personal") && creditSccore < 620) {
eligible = false;
}
if (employement.equals("Employement") || employement.equals("Self-Employement")) {
if (income < loanamount * 2) {
eligible = false;
}
} else if (employement.equals("Unemployement") || employement.equals("Student")) {
if (!purpose.equals("Education") || income < loanamount * 1.5) {
eligible = false;
}
}
double dti = debts / income;
if (dti > 0.4) {
eligible = false;
}
if (creditSccore < 600) {
eligible = false;
}
if (!eligible) {
System.out.println("Loan rejected");
return;
}
double interest = 0;
if (creditSccore >= 800 && creditSccore <= 850) {
interest = 3.0;
} else if (creditSccore >= 750) {
interest = 4.0;
} else if (creditSccore >= 700) {
interest = 5.0;
} else if (creditSccore >= 650) {
interest = 6.0;
} else if (creditSccore >= 600) {
interest = 7.0;
}
if (purpose.equals("Home") && creditSccore < 700) {
eligible = false;
} else if (purpose.equals("Car") && creditSccore < 650) {
eligible = false;
} else if (purpose.equals("Education") && creditSccore < 600) {
eligible = false;
} else if (purpose.equals("Business") && creditSccore < 680) {
eligible = false;
} else if (purpose.equals("Personal") && creditSccore < 620) {
eligible = false;
}
System.out.printf("Loan Approved. Assigned Interest Rate: %.2f%%\n", interest);
}
}