about summary refs log tree commit diff
path: root/usth/ICT2.2/final/Member.java
blob: a3e2092e921ae2ec1e7a83e9c4598d24da5a5bf7 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
public class Member
{
  public static final String[] ROLES = {"leader", "club coordinator",
                                        "keynote speaker of code sharing",
                                        "product programmer"};

  private String name;
  private String time;
  private int role;

  public String getName()
  {
    return name;
  }

  public String getTime()
  {
    return time;
  }

  public int getRole()
  {
    return role;
  }
  
  public void setName(String name)
  {
    this.name = name;
  }
  
  public void setTime(String time)
  {
    this.time = time;
  }
  
  public void setRole(int role) throws IllegalArgumentException
  {
    if (role < 0 || role > 3)
      throw new IllegalArgumentException("invalid role number: " + role);
    this.role = role;
  }

  public Member(String name, String time, int role)
  {
    setName(name);
    setTime(time);
    setRole(role);
  }

  public String toString()
  {
    return String.format("%s (%s), from %s", name, ROLES[role], time);
  }
}