forked from angiejones/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogicalOperatorLoanQualifier.java
More file actions
38 lines (29 loc) · 1.05 KB
/
Copy pathLogicalOperatorLoanQualifier.java
File metadata and controls
38 lines (29 loc) · 1.05 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
package chapter3;
import java.util.Scanner;
/*
* LOGICAL OPERATORS:
* To qualify for a loan, a person must make at least $30,000
* and have been working at their current job for at least 2 years.
*/
public class LogicalOperatorLoanQualifier {
public static void main(String args[]){
//Initialize what we know
int requiredSalary = 30000;
int requiredYearsEmployed = 2;
//Get what we don't
System.out.println("Enter your salary:");
Scanner scanner = new Scanner(System.in);
double salary = scanner.nextDouble();
System.out.println("Enter the number of years with your current employer:");
double years = scanner.nextDouble();
scanner.close();
//Make decision
if(salary >= requiredSalary && years >= requiredYearsEmployed){
System.out.println("Congrats! You qualify for the loan");
}
else{
System.out.println("Sorry, you must earn at least $"
+ requiredSalary + " to qualify for the loan");
}
}
}