-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathEmployee.java
42 lines (41 loc) · 1.21 KB
/
Employee.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
import java.util.Scanner;
public class Employee
{
String name;
int id;
double salary;
public void EmployeeDetails()
{
System.out.println("Employee name is: "+ name);
System.out.println("Employee id is: "+ id);
System.out.println("Employee name is: "+ salary);
}
public Employee()
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter the Name: ");
name = sc.nextLine();
System.out.print("Enter the id: ");
id = sc.nextInt();
System.out.print("Enter the Salary: ");
salary = sc.nextDouble();
}
public static void main(String [] args)
{
Employee[] emp = new Employee[5];
int i;
for(i = 0; i<5; i++)
{
System.out.println("\nEnter the details of Employee[" + (i+1) +"]");
emp[i] = new Employee();
System.out.println("###############");
}
System.out.println("\n\nThe Details of the employee are: \n");
for(i = 0; i<5; i++)
{
emp[i].EmployeeDetails();
System.out.println();
System.out.println("###############");
}
}
}