Hi Guys, I am a newbie trying to write an application and I get the following error when I try compiling! "Illegal start of expression" I have posted the code below! Please help!
/** * Default constructor for objects of class UniAdmin */ public UniAdmin() { studentList = new ArrayList<Student>(); courseList = new ArrayList<Course>(); units = new ArrayList<Units>(); aScanner = new Scanner(System.in); isRunning = true; }
/** * Create a Student */
public void createStudent() { System.out.println("Please enter the Name of the Student:"); System.out.println("Name: "); String name = aScanner.next();
//Validation for Name
System.out.println("Please enter the Gender:"); System.out.println("Male or Female:"); String gender = aScanner.next();
//Validation for Gender System.out.println("Please enter Address:"); System.out.println("Address:"); String address = aScanner.next();
//Validation for Address System.out.println("Please enter Phone Number:"); System.out.println("Phone no:"); String phoneNo = aScanner.next();
//Validation for Phoneno: System.out.println("Please Enter Student ID:"); System.out.println("Student Id:"); String studentId = aScanner.next();
//Validation for Student Id
System.out.println("Please Enter Level of Study:"); System.out.println("Postgrad or Undergrad:"); String StudentLevel = aScanner.next;
}
/** * Retrieve a particular Student * * @param Student ID */ public Student getStudentId(String studentID) { for (Student aStudent : studentList) { if (aStudent.getStudentId().equals(studentId)) return aStudent; } return null; }
/** * Create Course */
public void createCourse() { System.out.println("Please enter the student Id that the enrolment belongs to:"); String studentId = aScanner.next();
Student aStudent = getStudentId(studentId);
if (aStudent != null)
{ System.out.println("Please enter the Course Name:"); System.out.println("Course Name:"); String courseName = aScanner.next();
//Validation System.out.println("Please enter the Course Code:"); System.out.println("Course Name:"); String courseCode = aScanner(); }
/** * Create Unit */
public void createUnit()
{ System.out.println("Please enter the student Id that the enrolment belongs to:"); String studentId = aScanner.next();
Student aStudent = getStudentId(studentId);
if (aStudent != null)
{ System.out.println("Please enter the Unit Title:"); System.out.println("Course Title:"); String unitTitle = aScanner.next();
//Validation System.out.println("Please enter the Unit Code:"); System.out.println("Unit Code:"); String unitCode = aScanner.next(); } }
/** * Return the details of Enrolment * * @return details of the Enrolment */ public String toString() { String result = ""; for (Student aStudent : studentList) result += "******************************************\n" + aStudent.toString() + "\n";
result += "****************** End *******************\n";
return result; }
public static void main(String args[]) { uniAdmin admin = new uniAdmin();
while (admin.getIsRunning()) admin.processCommand(admin.promptOperation());
System.out.println("Thanks for using MonashBank system. System exit."); }
/** * Perform particular action based on the passed in command * * @param command */ public void processCommand(int command) { switch (command) { case 1: displayAllStudents(); break; case 2: createStudent(); break; case 3: createCourse(); break; case 4: createUnit(); break; case 5: displayPostgrads(); break; case 6: displayUndergrads(); break; case 7: displayCourses(); break; case 8: displayUnits(); break; case 9: deleteStudentRecord(); break; case 10: deleteCourse(); break; case 11: deleteUnit(); break; case 12: studentSummary(); break; case 13: courseSummary(); break; case 14: unitSummary(); break; case 15: System.out.println("Thank you using Monash Student Enrolment System, The System will now exit gracefully"); isRunning = false; aScanner.exit(); break; default: System.out.println("Error: Invalid command.Please enter a valid choice"); break; } }
/** * Ask user to select operation * * @return selected command */ public int promptOperation() { System.out.println("********** Monash University Enrolment System ***********"); System.out.println("Please select one of the following options by selecting an option:"); System.out.println("1. Display All Students"); System.out.println("2. Create a Student"); System.out.println("3. Create a Course"); System.out.println("4. Create a Unit"); System.out.println("5. Display Postgraduate Students"); System.out.println("6. Display Undergraduate Students"); System.out.println("7. Display Courses"); System.out.println("8. Display Units"); System.out.println("9. Delete Student Record"); System.out.println("10.Delete Course"); System.out.println("11.Delete Unit "); System.out.println("12.Print summary information of a student"); System.out.println("13.Print summary information of a course "); System.out.println("14.Print summary information of a unit "); System.out.println("15. Exit");
return aScanner.nextInt();
}
/** * Return the running status of the bank * * @return isRunning */ public boolean getIsRunning() { return isRunning; }
/** * Set the running status of the bank * * @param isRunning */ public void setRunning(boolean isRunning) { this.isRunning = isRunning; }