-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmpDataDemo.java
More file actions
39 lines (35 loc) · 1014 Bytes
/
Copy pathEmpDataDemo.java
File metadata and controls
39 lines (35 loc) · 1014 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
import java.util.Scanner;
class EmpDetail{
int empID,empSal;
String empName, empAdd;
EmpDetail(String name, String address,int id,int sal){
empName = name;
empAdd =address;
empID =id;
empSal = sal;
}
String getEmpDetail() {
return "Employee Id : " + empID + "\nEmployee Name : "+empName+ "\nEmployee Address : " +empAdd+"\nEmployee Sal : " + empSal;
}
}
class Show{
void dis(EmpDetail e) {
System.out.println(e.getEmpDetail());
}
}
public class EmpDataDemo {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter The Employee Name : ");
String name = s.nextLine();
System.out.println("Enter The Employee Address : ");
String ad = s.nextLine();
System.out.println("Enter The Employee ID : ");
int id = s.nextInt();
System.out.println("Enter The Employee Salary : ");
int sal = s.nextInt();
EmpDetail emp = new EmpDetail(name,ad,id,sal);
Show sw = new Show();
sw.dis(emp);
}
}