-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBandMember.java
156 lines (125 loc) · 3.61 KB
/
BandMember.java
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package com.example.vhl2.bandapp3;
import android.support.annotation.NonNull;
import java.io.Serializable;
/**
* Created by Vhl2 on 11/22/2017.
*/
public class BandMember implements Serializable, Comparable<BandMember>{
private String Name;
private String Password;
private Boolean Admin;
private String Year;
private String UserName;
private int points;
private String instrument;
public BandMember() {
Name = "blank";
Password = "1234";
Admin = false;
Year = "freshman";
UserName = "blank";
this.points = 0;
this.instrument = "blank";
}
public BandMember(String name, String password, String year, String userName, int points, String instrument) {
Name = name;
Password = password;
Admin = false;
Year = year;
UserName = userName;
this.points = points;
this.instrument = instrument;
}
public BandMember(String name, String password, Boolean admin, String year, String userName, int points, String instrument) {
Name = name;
Password = password;
Admin = admin;
Year = year;
UserName = userName;
this.points = points;
this.instrument = instrument;
}
/**
* constructor with default points
* @param name
* @param password
* @param admin
* @param year
* @param userName
* @param instrument
*/
public BandMember(String name, String password, Boolean admin, String year, String userName, String instrument) {
Name = name;
Password = password;
Admin = admin;
Year = year;
UserName = userName;
this.points = 0;
this.instrument = instrument;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
public Boolean getAdmin() {
return Admin;
}
public void setAdmin(Boolean admin) {
Admin = admin;
}
public String getYear() {
return Year;
}
public void setYear(String year) {
Year = year;
}
public String getUserName() {
return UserName;
}
public void setUserName(String userName) {
UserName = userName;
}
public int getPoints() {
return points;
}
public void setPoints(int points) {
this.points = points;
}
public String getInstrument() {
return instrument;
}
public void setInstrument(String instrument) {
this.instrument = instrument;
}
public void addPoints(int newPoints){
points += newPoints;
}
/**
* toString method for bandMember objects that shows their user name and points
* @return String Containing UserNames and Points
*/
@Override
public String toString() {
return UserName + " Total Points: " + points;
}
@Override
public int compareTo(@NonNull BandMember other) {
if (instrument.compareTo(other.getInstrument()) != 0) {
return this.instrument.compareTo(other.getInstrument());
} else {
if(UserName.compareTo(other.getUserName()) != 0) {
return this.UserName.compareTo(other.getUserName());
} else {
return 0;
}
}
}
}