-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkBasedEmployeeAgeGen.java
More file actions
29 lines (28 loc) · 1.17 KB
/
Copy pathWorkBasedEmployeeAgeGen.java
File metadata and controls
29 lines (28 loc) · 1.17 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
/*
* Ask user for age,gen(M or F) marital status (T or N) then use following rule to print their place of service
* if female,thenwork only in urban areas.
* if male & age in between 20 - 40 then he may work in anyware
* if male,age 40-60 work in urban areas only
* other input age print error
*/
import java.util.Scanner;
class WorkBasedEmployeeAgeGen {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Age:");
int age=sc.nextInt();
System.out.println("Enter Gender(M or F):");
String gen=sc.next().trim().strip().toUpperCase();
System.out.println("Enter marital Status(Y or N):");
String mStat=sc.next().trim().strip().toLowerCase();
if(gen.equals("F")){
System.out.println("employee can work only in urban areas.");
}else if(gen.equals("M") && (age>=20 && age <40)){
System.out.println("Employee can work from anyware.");
}else if(gen.equals("M") && (age>=40 && age <60)){
System.out.println("Employee can work in urban areas only.");
}else {
System.out.println("ERROR");
}
}
}