-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.java
More file actions
48 lines (42 loc) · 1.1 KB
/
Employee.java
File metadata and controls
48 lines (42 loc) · 1.1 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
package java1;
import java.util.Scanner;
//program to print employee details
public class Employee {
static Scanner s=new Scanner(System.in);
String name,address;
int yr;
float sal;
Employee(int a)
{
System.out.println("Enter the name of Employee "+a);
name=s.next();
System.out.println("Enter the year of joining of Employee "+a);
yr=s.nextInt();
System.out.println("Enter the salary of Employee "+a);
sal=s.nextFloat();
System.out.println("Enter the address of Employee "+a);
address=s.next();
System.out.println();
display(a);
}
public void display(int b)
{
System.out.println("employee "+b);
System.out.println("name: "+name);
System.out.println("year of joining: "+yr);
System.out.println("salary: "+sal);
System.out.println("address: "+address);
System.out.println();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int n;
System.out.println("Enter number of employees: ");
n=s.nextInt();
Employee e[]=new Employee[n];
for(int i=0;i<n;i++)
{
e[i]=new Employee(i+1);
}
}
}