-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathduplicateEmployee.java
More file actions
40 lines (32 loc) · 965 Bytes
/
Copy pathduplicateEmployee.java
File metadata and controls
40 lines (32 loc) · 965 Bytes
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
import java.util.Scanner;
public class duplicateEmployee {
int id;
String name;
double salary;
public void getDetails() {
Scanner sc = new Scanner(System.in);
System.out.println("enter id: ");
id=sc.nextInt();
sc.nextLine();
System.out.println("enter name: ");
name=sc.nextLine();
System.out.println("enter salary: ");
salary=sc.nextDouble();
}
public void displayDetails() {
System.out.println("Employee Details");
System.out.println("id: "+id);
System.out.println("name: "+name);
System.out.println("salary: "+salary);
}
public static void main(String[] args) {
duplicateEmployee Emp1=new duplicateEmployee();
System.out.println("enter details of employee 1: ");
Emp1.getDetails();
duplicateEmployee Emp2=new duplicateEmployee();
System.out.println("enter details of employee 2: ");
Emp2.getDetails();
Emp1.displayDetails();
Emp2.displayDetails();
}
}