-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestEmployeePMC.java
44 lines (37 loc) · 1.06 KB
/
TestEmployeePMC.java
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
import java.util.Scanner;
class Employee
{
private String name;
private int e_id;
private float salary;
private boolean status;
Employee(String name, int e_id, float salary, boolean status)
{
this.name=name; // Parameterised Constructor
this.e_id=e_id;
this.salary=salary;
this.status=status;
}
void getData()
{
System.out.println("Name:"+name+"\nEmp Id:"+e_id+"\nSalary:"+salary+"\nStatus:"+status);
}
}
/*** Main Class***/
class TestEmployeeScan
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter Name (String) of Employee: " );
String name=sc.nextLine();
System.out.println("Enter Employee ID (Integer) of Employee: " );
int e_id=sc.nextInt();
System.out.println("Enter Salary (Float) of Employee: " );
float salary=sc.nextFloat();
System.out.println("Enter Working Satus (Boolean) of Employee: " );
boolean status=sc.nextBoolean());
Employee e = new Employee(name,e_id,salary,status); //Call to constructor
e.getData();
}
}