about summary refs log tree commit diff
path: root/usth/ICT2.2/final/Problem3.java
blob: 11be143f4496928d3daa4cb33e1905bd340ca8a6 (plain) (blame)
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
import java.util.ArrayList;
import java.util.Scanner;

class Problem3
{
  public static void main(String... args)
  {
    var scanner = new Scanner(System.in);
    System.out.println("Number of members:");
    int n = scanner.nextInt();

    var members = new ArrayList<Member>();
    for (int i = 0; i < n; ++i)
      {
        System.out.println("Member name: ");
        String name = scanner.next();
        System.out.println("Member joining time: ");
        String time = scanner.next();
        System.out.println("Member role number: ");
        int role = scanner.nextInt();
        members.add(new Member(name, time, role));
      }

    var reports = new ArrayList<Report>();
    for (var m : members)
      {
        System.out.println(m);
        System.out.println("Activity: ");
        String act = scanner.next();
        System.out.println("Rate: ");
        int rate = scanner.nextInt();
        reports.add(new Report(m.getName(), act, rate));
      }

    System.out.println("Members:");
    members.forEach(System.out::println);
    System.out.println("Activity reports:");
    reports.forEach(System.out::println);
  }
}