about summary refs log tree commit diff
path: root/usth/ICT2.2/labwork/4/Employ.java
blob: 924e1d389e1ec22cd9c05db66e94b09f0b22585a (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
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;

class Employ
{
  private static Employee scan(Scanner s)
  {
    int ID = s.nextInt();
    s.nextLine();
    return new Employee(ID, s.nextLine(), s.nextLine(),
                        s.nextDouble(), s.nextDouble());
  }

  public static void main(String... args) throws FileNotFoundException
  {
    var stdin = new Scanner(System.in);
    var f = new File("employees.txt");
    var file = new Scanner(f);
    var employees = new ArrayList<Employee>();
    int n = stdin.nextInt();
    for (int i = 0; i < n; ++i)
      {
        employees.add(scan(stdin));
        employees.add(scan(file));
      }
    employees.forEach(System.out::println);
  }
}