This is part of the assignment:
public TestData()
The default constructor that will do the following:
prompt the user for and input a test name which is assigned to the testName field using the following input dialog box:
initialize the count field to 0
instantiate the scores array setting its size to MAXSIZE
invoke the loadArray() method to load the scores into the array.
private void loadArray()
The method is called in the constructor. The method prompts the user to input a score, stores the score in the array, and increments the field count by 1 for each score entered. The method should not allow more than 25 scores to be entered. The scores should be enter using the following input dialog box:
**The part in bold,italicize is one part I am having trouble with. Other than that, does this even look right?**
public TestData() {
Scanner keyboard = new Scanner(System.in);
testName = JOptionPane.showMessageDialog(null, "Input the name for the test. For example, Test1.");
for (int count = 0; count < MAXSIZE; count++)
{
scores[count] = keyboard.nextInt();
}
}
private void loadArray(int[] array) { // INPUT SCORES AND STORE SCORES IN ARRAY
for (int count = 0; count < MAXSIZE; count++)
input = JOptionPane.showMessageDialog(null, "Input test score and press ENTER (-1 to end");
Any help would be appreciated. Or if anyone can point me to a good website on arrays that would be helpful. I went on to the oracle site and that wasn't much help.

New Topic/Question
Reply




MultiQuote







|