-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmpp.java
More file actions
57 lines (42 loc) · 1.27 KB
/
Empp.java
File metadata and controls
57 lines (42 loc) · 1.27 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
49
50
51
52
53
54
55
56
57
import java.util.Scanner;
public class Empp {
private String name;
private int age;
private double sal;
Empp(){
name="UNKNOWN";
age=0;
sal=0;
}
Empp(String n , int m,double k){
this.name=n;
this.age=m;
this.sal=k;
}
public void Display() {
System.out.println("Name of the employee is "+name);
System.out.println("Age of the employee is "+age);
System.out.println("Salary of the employee is"+sal);
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
//String m;int k;double l;
System.out.println("Invoking non parametrized Constructor");
Empp m=new Empp();
System.out.println("Enter the number of employee detail u wanna Enter");
int n=sc.nextInt();
Empp [] E=new Empp[n];
System.out.println("Enter the details of the Employee");
for(int i=0;i<n;i++) {
System.out.println("Employee" +(i+1)+"name is ");
String name=sc.next();
System.out.println("Employee" +(i+1)+" age is ");
int age=sc.nextInt();
System.out.println("Employee" +(i+1)+" Salary is ");
double salary=sc.nextDouble();
E[i]=new Empp(name,age,salary);
System.out.println("Employee" +(i+1)+"details are :");
E[i].Display();
}
}
}