Hi
Can you please please help with my code??
Thanks
Tom
--- Update ---
* * SWE12075299 * Thomas Sweeney * Belfast Met (Titanic Quarter) * JAVA Programming Level 3 */ package studentassignment; import java.util.Scanner; /** * * @author Tom */ public class StudentAssignment { int [] NumberofStudents = new int [10]; int [] StudentRefNo = new int [10]; String [] Student = new String [10]; String [] NameofExamination = new String [3]; int [] [] ExamMarks = new int [10] [3]; boolean exit = false; /** * @param args the command line arguments */ static void main(String[] args) String [] Student = Surname + Forename; int option=0, count=0; //Put menu commands here public static void DisplayMenu() { System.out.println (" "); System.out.println (" "); System.out.println (" "); System.out.println (" MENU "); System.out.println (" ================== "); System.out.println (" 1) Please add the Students Name and Marks."); System.out.println (" 2) Modify the details of a Student."); System.out.println (" 3) Delete an existing Student."); System.out.println (" 4) Sort the Students in alphabetical order."); System.out.println (" 5) List the Student Names and Marks in ascending order."); System.out.println (" 6) List the Student Names and Marks in descending order."); System.out.println (" 7) Display the Student with the highest exam marks."); System.out.println (" 8) Display the Student with the lowest exam marks."); System.out.println (" 9) Display the average score of all of the students recorded."); System.out.println ("10) Exit Menu!"); System.out.println (" "); System.out.println (" Please enter the number 1 - 10:"); System.out.println (" "); } { int option; switch option; { case 1: System.out.println ("Option 1 selected"); break; case 2: System.out.println ("Option 2 selected"); break; case 3: System.out.println ("Option 3 selected"); break; case 4: System.out.println ("Option 4 selected"); break; case 5: System.out.println ("Option 5 selected"); break; case 6: System.out.println ("Option 6 selected"); break; case 7: System.out.println ("Option 7 selected"); break; case 8: System.out.println ("Option 8 selected"); break; case 9: System.out.println ("Option 9 selected"); break; case 10: System.out.println ("You have Exited the menu!"); break; default: System.out.println ("Nothing selected"); System.out.println ("Finished!"); } static void AddStudent (); //Positions marks in table Scanner keyb = new Scanner (System.in); { if (Student[0].isEmpty()) StudentRefNo [0]; Student [0] = Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else { if (Student [1].isEmpty()) StudentRefNo [1]; Student [1] = Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else { if (Student [2].isEmpty()) StudentRefNo [2]; Student [2]= Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else { if (Student [3].isEmpty()) StudentRefNo [3]; Student [3]= Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else { if (Student [4].isEmpty()){ StudentRefNo [4]; Student [4]= Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else { if (Student [5].isEmpty()){ StudentRefNo [5]; Student [5]= Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else if (Student [6].isEmpty()) StudentRefNo [6]; Student [6]= Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else { if (Student [7].isEmpty()) StudentRefNo [7]; Student [7]= Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else { if (Student [8].isEmpty()) StudentRefNo [8]; Student [8]= Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } else { if (Student [9].isEmpty()) StudentRefNo [9]; Student [9]= Surname + "," + Forename; ExamMarks[0][0] = Exam1; ExamMarks[0][1] = Exam2; ExamMarks[0][2] = Exam3; } static void AddStudents (String [] Student, int StudentRefNo) { int index; System.out.println ("\n\n*** Please enter the Students names *** \n\n"); for (index=0;index<=StudentRefNo-1;index=index+1) { Student [index]=""; } } } static void remove () { static void alphabetically () { Surname=InOut.readString (); Forename=InOut.readstring (); if ( Student [0].compareTo ( Student [9])<0) System.out.println ("\nThis will put Students in Alphabetical order"); System.out.println ("\t"+ Student [0]); } static void ascending (); String tempName; if (checkIfRecordExists()) { System.out.println("Student Reference Number\t Name \t ExamMarks1 \t ExamMarks2 \t ExamMarks3"); for (int i = 0; i < StudentRefNo; i++) { int l = i;} { for (int j = i + 1; j < StudentRefNo; j++)} { if (Student[i].trim().compareToIgnoreCase(Student[j].trim()) > 0) tempName = Student[j]; Student[j] = Student[i]; Student[i] = tempName; int[] tempMarks = ExamMarks[j]; ExamMarks[j] = ExamMarks[i]; ExamMarks[i] = tempMarks; } } System.out.print(++l + "\t " + Student[i] + "\t "); for (int k = 0; k < StudentRefNo; k++) { System.out.print(ExamMarks[i][k] + "\t\t "); } System.out.println(""); } } else { System.out.println("Enter record first to arrange in ascending!"); } static void descending (); String tempName;{ if (checkIfRecordExists() System.out.println("Student Reference Number\t Name \t ExamMarks1 \t ExamMarks2 \t ExamMarks3"); for (int i = 0; i < StudentRefNo; i++) int l = i; for (int j = i + 1; j < StudentRefNo; j++) if (Student[i].trim().compareToIgnoreCase(Student[j].trim()) < 0) { tempName = Student[j]; Student[j] = Student[i]; Student[i] = tempName; int[] tempMarks = ExamMarks[j]; ExamMarks[j] = ExamMarks[i]; ExamMarks[i] = tempMarks; } } System.out.print(++l + "\t " + Student[i] + "\t "); for (int k = 0; k < StudentRefNo; k++) { System.out.print(ExamMarks[i][k] + "\t\t "); } System.out.println(""); } } else { System.out.println("Enter record first to arrange in descending!"); } } static void maxmark () { double[] averageMarks = new double[ExamMarks]; double maxMarks = averageMarks[0]; if (checkIfRecordExists()) { int[] totalMarks = new int[StudentRefNo]; String StudentWithMaxMarks = ""; for (int i = 0; i < StudentRefNo; i++) { for (int j = 0; j < NameofExamination; j++) { //getting sum of three subject and storing in Marks 1 totalMarks[i] += ExamMarks[i][j]; } //Calculating average marks for all students averageMarks[i] = (double) ((totalMarks[i]) / 3); //Comparing avarage marks and displaying max if (averageMarks[i] > maxMarks) { maxMarks = averageMarks[i]; StudentWithMaxMarks = Student[i]; } } System.out.println(StudentWithMaxMarks + " has obtained max average score of:" + maxMarks); } else { System.out.println("Add record first to find the avg max score!"); } return maxMarks; } } static void minmark() { if (checkIfRecordExists()) { double[] averageMarks = new double[StudentRefNo]; double minMarks = averageMarks[0];//DisplayMaxRecord(); int[] totalMarks = new int[StudentRefNo]; String StudentWithMinMarks = ""; for (int i = 0; i < StudentRefNo; i++) { for (int j = 0; j < NameofExamination; j++) { //getting sum of three subject and storing in Marks 1 totalMarks[i] += ExamMarks[i][j]; } //Calculating average marks for all students averageMarks[i] = (double) ((totalMarks[i]) / 3); minMarks = averageMarks[0]; StudentWithMinMarks = Student[0]; //Comparing avarage marks and displaying max if (averageMarks[i] < minMarks) { minMarks = averageMarks[i]; StudentWithMinMarks = Student[i]; } } System.out.println(StudentWithMinMarks + " has obtained min average score of:" + minMarks); } else { System.out.println("Add record first to find the avg min score!"); } } } static void CalculateaverageExamMarks (int [] ExamMarks, int size) { int index; double dblTotal; double dblCalculateaverageExamMarks; dblTotal = 0.0; for (index=0;index<=size-1; index=index+1) { // adding array value to the total dblTotal = dblTotal + ExamMarks [index]; }// end of for loop dblCalculateaverageExamMarks = dblTotal/size; return dblCalculateaverageExamMarks; } }
--- Update ---
Here are the errors it is compiling:
int[] totalMarks = new int[StudentRefNo]; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:293: class, interface, or enum expected String StudentWithMinMarks = ""; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:294: class, interface, or enum expected for (int i = 0; i < StudentRefNo; i++) { C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:294: class, interface, or enum expected for (int i = 0; i < StudentRefNo; i++) { C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:294: class, interface, or enum expected for (int i = 0; i < StudentRefNo; i++) { C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:295: class, interface, or enum expected for (int j = 0; j < NameofExamination; j++) { C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:295: class, interface, or enum expected for (int j = 0; j < NameofExamination; j++) { C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:298: class, interface, or enum expected } C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:301: class, interface, or enum expected minMarks = averageMarks[0]; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:302: class, interface, or enum expected StudentWithMinMarks = Student[0]; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:304: class, interface, or enum expected if (averageMarks[i] < minMarks) { C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:306: class, interface, or enum expected StudentWithMinMarks = Student[i]; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:307: class, interface, or enum expected } C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:310: class, interface, or enum expected } else { C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:312: class, interface, or enum expected } C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:318: class, interface, or enum expected double dblTotal; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:319: class, interface, or enum expected double dblCalculateaverageExamMarks; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:321: class, interface, or enum expected dblTotal = 0.0; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:323: class, interface, or enum expected for (index=0;index<=size-1; index=index+1) C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:323: class, interface, or enum expected for (index=0;index<=size-1; index=index+1) C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:323: class, interface, or enum expected for (index=0;index<=size-1; index=index+1) C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:328: class, interface, or enum expected }// end of for loop C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:332: class, interface, or enum expected return dblCalculateaverageExamMarks; C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\src\studentassignment\StudentAssignment.java:333: class, interface, or enum expected } 91 errors C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\nbproject\build-impl.xml:915: The following error occurred while executing this line: C:\Users\Tom\Documents\NetBeansProjects\StudentAssignment\nbproject\build-impl.xml:268: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 8 seconds)