I am creating a simple program to hold competitor details for a ski race competition after every race, a time is entered, and the results is sorted with the least time as position one, am not using realtime but int or double, I've got a suggestion to use arrays rather than a Vector, am not sure how to store the competitors time so that if a new time is entered the result and their position can be sorted any advice. below is my competitor class. package skiracescoreboard04_05;
public class Competitor { private String compNo; private String name; private String country; private double result; private int position;
public Competitor()//default constructor { this.compNo = "9999"; this.name = "No Name"; this.country = "N/A"; this.position = 00; result = -1; // to signify no result yet }
public Competitor(String compNo, String name, String country)//result and position is not yet achieved { this.compNo = compNo; this.name = name; this.country = country; this.position = position; result = -1; // to signify no result yet }
public void addResult(double result) { this.result = result; }
public String getCompNo() { return compNo; }
public String getName() { return name; }
public String getCountry() { return country; }
public double getResult() { return result; }
public int getPosition() { return position; }
public boolean hasResult() { return result != -1; }