We'd need to see more to track this down. There's only one definite error here (lowercase "system" should be "System", uppercase) but potentially more, depending on where and how various variables are declared. Furthermore, errors like "expected ;", "}" or "{" often really mean an error in some earlier part of the code; the line pointed to is where the compiler just gave up trying to figure things out, but the problem happened elsewhere. So lets see the whole file up to and including this passage.
Hi, maybe it was just an error copying it ot the post, but did you forget a pair of braces?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
public class StuTestAnn { private static Scanner keyboard = new Scanner(System.in);
public static void main(String[] args)
{ int students; int tests; int[][] testScores; // [students][tests] String[] stuNames;
testScores = createArray(); if(testScores != null) { stuNames = new String[testScores.length]; populateNames(stuNames); populateTestScores(stuNames,testScores); // printStudentReport(stuNames,testScores); // printTestReport(stuNames,testScores); out.println("\n\nGoodbye!\n\n"); } else { out.println("Array not successfully created - exiting"); } }
// Code your 5 methods below...
//createArray public static int[][] createArray() {
int[][] theArray; theArray = new int[students][tests]; return theArray; }
//populateNames public static void populateNames(String[]theNames)
for (i=0;i<test.length;i++) { system.out.println("Please enter the student's name."); theName[i]= keyboard.next; system.out.println(theName[i]);
}
//populateTestScores
public static void populateTestScores(int[][]theScores) for (i=0; i<tests.length; i++) { for(j=0;j<tests[0].length;j++) { system.out.println("Please enter test score."); tests[i] = keyboard.nextInt(); } }
When posting code please use the code tags. This will preserve formatting and make it easier to read. I suggest you take a closer look at Stan's posting, then at your code. The compiler will tell you roughly where the problem occurred. If you are still stuck then, come back.
Thanks everyone. I fixed the braces and the (). That caused 26 more errors to appear. I have figured out all but 2. Still plugging along. Again, thank you for the help!
Frances
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
That caused 26 more errors to appear.
Isn't that just the way life goes? Keep having fun!
This might be the perfect time to point something out... if you are getting 26 errors after fixing two or three, you are not compiling often enough. it sounds like you wrote the whole program, and are only now compiling it for the first time.
What i'd suggest you do from now on, is every time you write 3-4 new lines of code, it compile it again. that way, if you get an error, you KNOW which 3-4 lines caused the problem.
try to write as little as possible each time you re-compile. test it as you go.
believe me, that will make your life much easier in the long run.
Never ascribe to malice that which can be adequately explained by stupidity.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.