how do i use record(int score) from the class Stats to record a new score?
public class ScoreInfo {
private int score;
private int numStudents;
public ScoreInfo(int aScore){
score = aScore;
numStudents=1;
}
public void increment(){numStudents++;}
public int getScore(){return score;}
public int getFrequency(){return numStudents;}
}
import java.util.ArrayList;
import java.*;
public class Stats
{
private ArrayList<ScoreInfo> scoreList;
public boolean record(int score)
{
int k=0;
while(k<scoreList.size() && score > scoreList.get(k).getScore()){
k++;
}
boolean found = k<scoreList.size() && score == scoreList.get(k).getScore();
if(found){scoreList.get(k).increment();}
else{scoreList.add(k,new ScoreInfo(score));}
return found;
}
public void recordScores(int[] stuScores)
{
}
static int score = 50;
public static void main(String[] args) throws Exception
{
Stats stats = new Stats();
ScoreInfo thestat = new ScoreInfo(score);
stats.scoreList.add(thestat);
}
}