-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathArrayEmpTester.java
64 lines (51 loc) · 1.46 KB
/
ArrayEmpTester.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package Array;
import java.util.Scanner;
public class ArrayEmpTester {
public static void main(String[] args) {
// TODO Auto-generated method stub
int choice;
Scanner sc = new Scanner(System.in);
// ArrayEmployee e=new ArrayEmployee();
System.out.println("Enter the number to store emp imformation..");
ArrayEmp[] arr = new ArrayEmp[sc.nextInt()];
int i;
do {
System.out.println("ENter Choice : ");
choice = sc.nextInt();
switch (choice) {
case 1:
System.out.println("Enter Employee details");
for (i = 0; i < arr.length; i++) {
System.out.println("Enter empid,ename,city,sal");
ArrayEmp e = new ArrayEmp(sc.nextInt(), sc.next(), sc.next(), sc.nextDouble());
arr[i] = e;
}
break;
case 2:
System.out.println("Display Empoyee Details....");
for (i = 0; i < arr.length; i++) {
System.out.println(arr[i].toString());
}
break;
case 3:
System.out.println("Enter empid for set city and name");
int id = sc.nextInt();
for (i = 0; i < arr.length; i++) {
if (arr[i].getEmpid() == id) {
arr[i].setEname(sc.next());
arr[i].getEname();
arr[i].setCity(sc.next());
arr[i].getCity();
System.out.println(arr[i]);
}
else {
System.out.println("Enter valid Empid..");
}
}
break;
default:
System.out.println("Invalid Choice.....");
}
} while (choice < 4);
}
}