-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson5nestedifststement.java
More file actions
71 lines (48 loc) · 2.48 KB
/
Lesson5nestedifststement.java
File metadata and controls
71 lines (48 loc) · 2.48 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
import java.util.Scanner;
public class Lesson5nestedifststement {
public static void main (String [] args){
/*
nested if statement... this control statement contains if statements within if statement
the nested condition is only when the condition is true if found in the if block,
if its is in the else block then is executed if the condition is false
the nested if my comprise of if() statement
else if statement and also the else statement.
*/
/*
write a program tha a bank uses to determine the credibility of a customer...
the criteria for f=giving credit is
1.The customer must have credit score > 700;
2. the customer must have salary > 45000;
if less by just 10000 and meets all the other conditions approve, but it needs at least 1 guarantor trustee
if less by just 20,000 and meets all other conditions approve, but the client need 5 guarantors
3. must be employed for years >=2 years
the system should ask for input of the credit score monthly salary and the years of employment
use if statement to create / build ths program
*/
int creditScore=0;
double monthlySalary=0,
yearsWorked=0;
Scanner userInput=new Scanner(System.in);
System.out.print(" enter your credit Score here please: ");
creditScore= userInput.nextInt();
System.out.print("Enter the number of years you have been employed: ");
yearsWorked= userInput.nextDouble();
System.out.print("Enter your monthly salary: ");
monthlySalary= userInput.nextDouble();
if(creditScore>700){
if (yearsWorked>=2){
if(monthlySalary>45000){
System.out.println("Congratulations!! You qualify for the loan applied ");
}else if (monthlySalary >= 35000){
System.out.println("allowed ON CONDITION that there is at least one grantor ");
}else if(monthlySalary <35000 && !(monthlySalary<25000)) {
System.out.println("loan granted only on condition that you have at least 5 grantors ");
}else {
System.out.println("Denied on account of low monthly income");
}
}
}else{
System.out.println("Denied, low credit Score!!");
}
}
}