-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee1.java
More file actions
51 lines (44 loc) · 1.03 KB
/
Employee1.java
File metadata and controls
51 lines (44 loc) · 1.03 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
import java.util.Scanner;
class Employee
{
int id;
String name;
String Department;
int salary;
void setDetails(int id,String name,String Department,int salary)
{
this.id=id;
this.name=name;
this.Department=Department;
this.salary=salary;
}
Employee()
{
setDetails(id,name,Department,salary);
}
void showDetails()
{
System.out.println(id+" "+name+" "+Department+" "+salary);
}
}
public class Employee1
{
public static void main(String[] args)
{
Scanner ok=new Scanner(System.in);
System.out.print("Enter id: ");
int i=ok.nextInt();
Scanner te=new Scanner(System.in);
System.out.print("Enter name: ");
String s=te.nextLine();
Scanner kh=new Scanner(System.in);
System.out.print("Enter Department: ");
String d=kh.nextLine();
Scanner obj1=new Scanner(System.in);
System.out.print("Enter Salary: ");
int o=obj1.nextInt();
Employee obj=new Employee();
obj.setDetails(i,s,d,o);
obj.showDetails();
}
}