chriscct1

Untitled

Nov 18th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.67 KB | None | 0 0
  1.     public static void main(String[]args) {
  2.         CCMS output = new CCMS();
  3.         output.newprintln("Welcome to the Christoff Course Management System.", true);
  4.         output.newprintln("Copyright 2012 Chris Christoff", true);
  5.         output.newprintln("Version: 2.1", true);
  6.         output.newprintln("Build: 8350a46486a9ece9e4df2cf333f9d3eab91e53fe", true); // Git application's hash for this commit number
  7.         output.cleaner(2);
  8.         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);
  9.         output.cleaner(2);
  10.         output.pauser(1, false);
  11.         output.newprintln("Please wait while we load the system", false);
  12.         output.pauser(10, true);
  13.         output.cleaner(2);
  14.         // Make Courses
  15.         Course[]courselist = new Course[3];
  16.         courselist[0] = new Course(1500, "Why PHP > All Other Languages");
  17.         courselist[1] = new Course(3003, "How to Make a Garage Management System In PHP");
  18.         courselist[2] = new Course(2006, "Programming PHP");
  19.         // Make Students + Enroll them
  20.         Student[]studentlist = new Student[7];
  21.         studentlist[0] = new Student(814662528, "James Stephens");
  22.         studentlist[0].enroll(courselist[0]);
  23.         studentlist[0].enroll(courselist[1]);
  24.         studentlist[1] = new Student(814579712, "Cary Hessler");
  25.         studentlist[1].enroll(courselist[0]);
  26.         studentlist[1].enroll(courselist[1]);
  27.         studentlist[2] = new Student(814526272, "James Beans");
  28.         studentlist[2].enroll(courselist[0]);
  29.         studentlist[2].enroll(courselist[1]);
  30.         studentlist[3] = new Student(814188544, "Steve Curry");
  31.         studentlist[3].enroll(courselist[0]);
  32.         studentlist[3].enroll(courselist[2]);
  33.         studentlist[4] = new Student(814352768, "Stetson Gafford");
  34.         studentlist[4].enroll(courselist[2]);
  35.         studentlist[4].enroll(courselist[1]);
  36.         studentlist[5] = new Student(814067008, "Tomit Huynh");
  37.         studentlist[5].enroll(courselist[2]);
  38.         output.pauser(1, false);
  39.         studentlist[5].enroll(courselist[1]); // this should fail as there is no room for students in this class
  40.         studentlist[6] = new Student(814462208, "Mike Hannaford");
  41.         studentlist[6].enroll(courselist[2]);
  42.         output.pauser(1, false);
  43.         studentlist[6].enroll(courselist[1]); // this should fail as there is no room for students in this class
  44.         output.pauser(1, false);
  45.         // Make Teachers + Enroll them
  46.         Teacher[]teacherlist = new Teacher[2];
  47.         teacherlist[0] = new Teacher(814952064, "Chris Christoff");
  48.         teacherlist[0].teaches(courselist[0]);
  49.         teacherlist[0].teaches(courselist[1]);
  50.         teacherlist[1] = new Teacher(814304576, "Rasmus Lerdorf");
  51.         teacherlist[1].teaches(courselist[2]);
  52.         output.pauser(1, false);
  53.         teacherlist[1].teaches(courselist[2]); // this should fail (print error) because hes already teaching this class
  54.         output.pauser(1, false);
  55.         // Display Courses
  56.         output.displayCourses(courselist);
  57.         output.pauser(2, false);
  58.         // Display list of students
  59.         output.displayStudents(studentlist);
  60.         output.pauser(2, false);
  61.         // Display list of teachers
  62.         output.displayTeachers(teacherlist);
  63.         output.pauser(2, false);
  64.         output.cleaner(2);
  65.         boolean noexitloop=true; // used to know whether or not to keep in loop
  66.         while (noexitloop){ // used so that you get reprompted after looking up a student via ID
  67.         System.out.println("Enter UID of a student, 1 to logout, 2 for list of students, or 3 for Operator");
  68.         int intparsed=Console.readInteger("Enter command: ", "Invalid input."); // Read the int they entered
  69.         while((intparsed!=1)&&(intparsed!=3)&&(!output.uidofstudent(intparsed,studentlist))){ // while invalid input
  70.         intparsed=Console.readInteger("Invalid input. Enter command: ", "Invalid input."); // reprompt
  71.         }
  72.         // Asked for Operator (bad move)
  73.         if (intparsed == 3) {
  74.         output.newprintln("Computer: I'm not your slave!\nlogging out!", false);
  75.         output.pauser(2, false);
  76.         output.logout(3);
  77.         }
  78.         // Asked to see Student List
  79.         if (intparsed == 2) {
  80.         output.displayStudents(studentlist);
  81.         output.cleaner(2);
  82.         output.pauser(1,false);
  83.         }
  84.         // Asked to Logout
  85.         if (intparsed == 1) {
  86.         output.logout(1);
  87.         }
  88.         // Asked to See a Student
  89.         else{
  90.         output.displayOneStu(courselist, studentlist, intparsed);
  91.         output.cleaner(2);
  92.         output.pauser(1,false);
  93.         }
  94.         }
  95.         System.exit(0);
  96.     }
Advertisement
Add Comment
Please, Sign In to add comment