forked from AllenDowney/ThinkJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.java
More file actions
57 lines (52 loc) · 1.8 KB
/
Employee.java
File metadata and controls
57 lines (52 loc) · 1.8 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
import java.util.Random;
import java.util.Scanner;
public class Employee
{
public static void main(String[] args)
{
int birthyear=1992;
boolean isUnionMember= true;
String fristname="Avi";
String Lastname="Garud";
String middlename="Vishwanath";
int employeeNumber ;
Scanner scanner=new Scanner(System.in);
printHeader();
System.out.println("Please enter your 5 digit employee number ");
employeeNumber=scanner.nextInt();
printFullName(fristname,Lastname,middlename);
printUnionStatus(isUnionMember);
printAge(birthyear);
printEvenOrOdd(employeeNumber);
printGeneratedScreatPassword(employeeNumber);
}
public static void printHeader()
{
System.out.println("Welcome to the wallabutech Employee Application");
System.out.println("===============================================");
}
public static void printFullName(String fristname,String Lastname,String middlename)
{
System.out.println(Lastname+","+fristname+" "+middlename);
}
public static void printUnionStatus(boolean isUnioMember)
{
System.out.println("Your Union statues :"+isUnioMember);
}
public static void printAge(int birthyear)
{
int age=2018-birthyear;
System.out.println("Your Agr is :"+age);
}
public static void printEvenOrOdd( int employeeNumber )
{
System.out.println("Employee number is even /odd(1=odd,0=even:"+employeeNumber%2);
}
public static void printGeneratedScreatPassword(int employeeNumber)
{
Random random=new Random();
int number =random.nextInt(10)+1;
int password=(employeeNumber+number)*5;
System.out.println("Employee's random secreat pw is:"+password);
}
}