Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[]args) {
- CCMS output = new CCMS();
- output.newprintln("Welcome to the Christoff Course Management System.", true);
- output.newprintln("Copyright 2012 Chris Christoff", true);
- output.newprintln("Version: 2.1", true);
- output.newprintln("Build: 8350a46486a9ece9e4df2cf333f9d3eab91e53fe", true); // Git application's hash for this commit number
- output.cleaner(2);
- output.newprintln("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA", true);
- output.cleaner(2);
- output.pauser(1, false);
- output.newprintln("Please wait while we load the system", false);
- output.pauser(10, true);
- output.cleaner(2);
- // 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]);
- output.pauser(1, false);
- 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]);
- output.pauser(1, false);
- studentlist[6].enroll(courselist[1]); // this should fail as there is no room for students in this class
- output.pauser(1, false);
- // 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]);
- output.pauser(1, false);
- teacherlist[1].teaches(courselist[2]); // this should fail (print error) because hes already teaching this class
- output.pauser(1, false);
- // Display Courses
- output.displayCourses(courselist);
- output.pauser(2, false);
- // Display list of students
- output.displayStudents(studentlist);
- output.pauser(2, false);
- // Display list of teachers
- output.displayTeachers(teacherlist);
- output.pauser(2, false);
- output.cleaner(2);
- 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, 1 to logout, 2 for list of students, or 3 for Operator");
- int intparsed=Console.readInteger("Enter command: ", "Invalid input."); // Read the int they entered
- while((intparsed!=1)&&(intparsed!=3)&&(!output.uidofstudent(intparsed,studentlist))){ // while invalid input
- intparsed=Console.readInteger("Invalid input. Enter command: ", "Invalid input."); // reprompt
- }
- // Asked for Operator (bad move)
- if (intparsed == 3) {
- output.newprintln("Computer: I'm not your slave!\nlogging out!", false);
- output.pauser(2, false);
- output.logout(3);
- }
- // Asked to see Student List
- if (intparsed == 2) {
- output.displayStudents(studentlist);
- output.cleaner(2);
- output.pauser(1,false);
- }
- // Asked to Logout
- if (intparsed == 1) {
- output.logout(1);
- }
- // Asked to See a Student
- else{
- output.displayOneStu(courselist, studentlist, intparsed);
- output.cleaner(2);
- output.pauser(1,false);
- }
- }
- System.exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment