-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputSchedule.java
More file actions
executable file
·49 lines (40 loc) · 981 Bytes
/
InputSchedule.java
File metadata and controls
executable file
·49 lines (40 loc) · 981 Bytes
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
import java.util.*;
import java.io.*;
class Person
{
// 7 days, 5 times per day
int[][] preferences;
String name;
public Person(String name)
{
this.name = name;
preferences = new int[7][5];
}
}
public class InputSchedule
{
String filename;
public static ArrayList<Person> people;
public InputSchedule(String filename)
{
this.filename = filename;
people = new ArrayList<>();
}
public void read_preferences() throws FileNotFoundException
{
Scanner in = new Scanner(new File(filename));
for (int i = 0; i < 7; i++)
{
String name = in.next();
Person p = new Person(name);
for (int time = 0; time < 5; time++)
{
for (int day = 0; day < 7; day++)
{
p.preferences[day][time] = in.nextInt();
}
}
people.add(p);
}
}
}