-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.java
More file actions
48 lines (45 loc) · 926 Bytes
/
Employee.java
File metadata and controls
48 lines (45 loc) · 926 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
41
42
43
44
45
46
47
48
import java.util.Scanner;
class Details
{
String name;
int empno;
long phno;
Details(String name, int empno, long phno)
{
this.name=name;
this.empno=empno;
this.phno=phno;
}
void display()
{
System.out.println("Employee Name:"+name);
System.out.println("Employee Number:"+empno);
System.out.println("Phone number:"+phno);
}
}
class Employee
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
System.out.println("Enter the number of employee");
int n = sc.nextInt();
Details[] employee = new Details[n];
for(int i=0;i<n;i++)
{
System.out.println("Enter the name of the employee");
String name = sc.next();
System.out.println("Enter the employee number");
int empNo = sc.nextInt();
System.out.println("Enter the phone number");
long phNo = sc.nextLong();
employee[i]=new Details(name,empNo,phNo);
System.out.println();
}
for(int i=0;i<n;i++)
{
employee[i].display();
System.out.println();
}
}
}