Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[]args) {
- CCMS output = new CCMS();
- // Make Courses
- Course[]courselist = new Course[3];
- courselist[0] = new Course(1500, "Why PHP > All Other Languages");
- courselist[1] = new Course(3003, "How to Make a Garage Management System In PHP");
- courselist[2] = new Course(2006, "Programming PHP");
- // Make Students + Enroll them
- Student[]studentlist = new Student[7];
- studentlist[0] = new Student(814662528, "James Stephens");
- studentlist[0].enroll(courselist[0]);
- studentlist[0].enroll(courselist[1]);
- studentlist[1] = new Student(814579712, "Cary Hessler");
- studentlist[1].enroll(courselist[0]);
- studentlist[1].enroll(courselist[1]);
- studentlist[2] = new Student(814526272, "James Beans");
- studentlist[2].enroll(courselist[0]);
- studentlist[2].enroll(courselist[1]);
- studentlist[3] = new Student(814188544, "Steve Curry");
- studentlist[3].enroll(courselist[0]);
- studentlist[3].enroll(courselist[2]);
- studentlist[4] = new Student(814352768, "Stetson Gafford");
- studentlist[4].enroll(courselist[2]);
- studentlist[4].enroll(courselist[1]);
- studentlist[5] = new Student(814067008, "Tomit Huynh");
- studentlist[5].enroll(courselist[2]);
- studentlist[5].enroll(courselist[1]); // this should fail as there is no room for students in this class
- studentlist[6] = new Student(814462208, "Mike Hannaford");
- studentlist[6].enroll(courselist[2]);
- studentlist[6].enroll(courselist[1]); // this should fail as there is no room for students in this class
- // Make Teachers + Enroll them
- Teacher[]teacherlist = new Teacher[2];
- teacherlist[0] = new Teacher(814952064, "Chris Christoff");
- teacherlist[0].teaches(courselist[0]);
- teacherlist[0].teaches(courselist[1]);
- teacherlist[1] = new Teacher(814304576, "Rasmus Lerdorf");
- teacherlist[1].teaches(courselist[2]);
- teacherlist[1].teaches(courselist[2]); // this should fail (print error) because hes already teaching this class
- // Display Courses
- output.displayCourses(courselist);
- // Display list of students
- output.displayStudents(studentlist);
- // Display list of teachers
- output.displayTeachers(teacherlist);
- boolean noexitloop=true; // used to know whether or not to keep in loop
- while (noexitloop){ // used so that you get reprompted after looking up a student via ID
- System.out.println("Enter UID of a student");
- int intparsed=Console.readInteger("Enter command: ", "Invalid input."); // Read the int they entered
- while((!output.uidofstudent(intparsed,studentlist)){ // while invalid input
- intparsed=Console.readInteger("Invalid input. Enter command: ", "Invalid input."); // reprompt
- }
- output.displayOneStu(courselist, studentlist, intparsed);
- }
- }
- System.exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment