chriscct1

Untitled

Nov 18th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. public static void main(String[]args) {
  2. CCMS output = new CCMS();
  3. // Make Courses
  4. Course[]courselist = new Course[3];
  5. courselist[0] = new Course(1500, "Why PHP > All Other Languages");
  6. courselist[1] = new Course(3003, "How to Make a Garage Management System In PHP");
  7. courselist[2] = new Course(2006, "Programming PHP");
  8. // Make Students + Enroll them
  9. Student[]studentlist = new Student[7];
  10. studentlist[0] = new Student(814662528, "James Stephens");
  11. studentlist[0].enroll(courselist[0]);
  12. studentlist[0].enroll(courselist[1]);
  13. studentlist[1] = new Student(814579712, "Cary Hessler");
  14. studentlist[1].enroll(courselist[0]);
  15. studentlist[1].enroll(courselist[1]);
  16. studentlist[2] = new Student(814526272, "James Beans");
  17. studentlist[2].enroll(courselist[0]);
  18. studentlist[2].enroll(courselist[1]);
  19. studentlist[3] = new Student(814188544, "Steve Curry");
  20. studentlist[3].enroll(courselist[0]);
  21. studentlist[3].enroll(courselist[2]);
  22. studentlist[4] = new Student(814352768, "Stetson Gafford");
  23. studentlist[4].enroll(courselist[2]);
  24. studentlist[4].enroll(courselist[1]);
  25. studentlist[5] = new Student(814067008, "Tomit Huynh");
  26. studentlist[5].enroll(courselist[2]);
  27. studentlist[5].enroll(courselist[1]); // this should fail as there is no room for students in this class
  28. studentlist[6] = new Student(814462208, "Mike Hannaford");
  29. studentlist[6].enroll(courselist[2]);
  30. studentlist[6].enroll(courselist[1]); // this should fail as there is no room for students in this class
  31. // Make Teachers + Enroll them
  32. Teacher[]teacherlist = new Teacher[2];
  33. teacherlist[0] = new Teacher(814952064, "Chris Christoff");
  34. teacherlist[0].teaches(courselist[0]);
  35. teacherlist[0].teaches(courselist[1]);
  36. teacherlist[1] = new Teacher(814304576, "Rasmus Lerdorf");
  37. teacherlist[1].teaches(courselist[2]);
  38. teacherlist[1].teaches(courselist[2]); // this should fail (print error) because hes already teaching this class
  39. // Display Courses
  40. output.displayCourses(courselist);
  41. // Display list of students
  42. output.displayStudents(studentlist);
  43. // Display list of teachers
  44. output.displayTeachers(teacherlist);
  45. boolean noexitloop=true; // used to know whether or not to keep in loop
  46. while (noexitloop){ // used so that you get reprompted after looking up a student via ID
  47. System.out.println("Enter UID of a student");
  48. int intparsed=Console.readInteger("Enter command: ", "Invalid input."); // Read the int they entered
  49. while((!output.uidofstudent(intparsed,studentlist)){ // while invalid input
  50. intparsed=Console.readInteger("Invalid input. Enter command: ", "Invalid input."); // reprompt
  51. }
  52. output.displayOneStu(courselist, studentlist, intparsed);
  53. }
  54. }
  55. System.exit(0);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment