-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestlectures.java
More file actions
45 lines (32 loc) · 1.18 KB
/
Copy pathtestlectures.java
File metadata and controls
45 lines (32 loc) · 1.18 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
package SatuApril;
import java.util.Scanner;
public class testlectures {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("How many Lecturer?");
int number = input.nextInt();
lectures[] oop = new lectures[number];
for(int i = 0 ; i<number ; i++) {
oop[i] = new lectures();
System.out.println("Lecturer" + (i+1));
System.out.print("Enter name: ");
oop[i].setname (input.next());
System.out.print("\nEnter age: ");
oop[i].setage (input.nextInt());
System.out.print("\nEnter staff id: ");
oop[i].setid (input.next());
System.out.print("\nEnter address: ");
oop[i].setaddr (input.next());
System.out.print("\nEnter salary: ");
oop[i].setsalary (input.nextDouble());
}
for(int k =0 ; k<number ; k++) {
System.out.println("Lecturer" + (k+1));
System.out.println("\nName: " + oop[k].getname());
System.out.println("Age: " + oop[k].getage());
System.out.println("Staff ID: " + oop[k].getid());
System.out.println("Address: " + oop[k].getaddr());
System.out.println("Salary: " + oop[k].getsalary());
}
}
}