Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * COSC 1020 - Project 6
- * Explain briefly the functionality of the class.
- * @author Chris Nadolny Conor Ward
- * jain
- * TA-BOT:MAILTO chris.nadolny@marquette.edu conor.ward@marquette.edu
- */
- public class Candidate extends Citizen implements OrderedSet{
- private char party;
- private String name;
- private int supporters;
- public char getParty(){
- return party;
- }
- public void setParty(char party) {
- this.party = party;
- }
- public int getSupporters(){
- return supporters;
- }
- public void increaseSupporterBy(int count) {
- supporters += count;
- }
- public Candidate(String name, char party) {
- super(name);
- this.name = name;
- this.party = party;
- supporters = 0;
- }
- public OrderedSet[] sort(OrderedSet[] s, int criterion) {
- OrderedSet temp;
- if (s==null) return null;
- if (criterion != 0) return s;
- else {
- for (int i = 0; i < s.length-1; i++) {
- for (int j = i+1; j < s.length; j++) {
- if (((Citizen) s[i]).getName().compareTo(((Citizen) s[j]).getName())>0) {
- temp = s[i];
- s[i] = s[j];
- s[j] = temp;
- }
- }
- }
- return s;
- } }
- public static void main(String[] args) {
- }
- }
Add Comment
Please, Sign In to add comment