import structure.*; import com.mw.io.*; import java.io.*; // This program is a skeleton for the registration project; lab 10 public class Student implements Comparable { public int student_id; public int student_class; public int numDesired; // no. of courses on first line of reg. card public int numChoices; // total no. of courses listed on all lines public Vector student_choices; // course_names of all courses listed public int numEnrolled; // no. of courses in which student is enrolled public Student() { student_id = 0; student_class = 0; numDesired = 0; // number of courses on the first line of the card numChoices = 0; // total number of courses provided on the card student_choices = new Vector(); // vector of course choices numEnrolled = 0; } public boolean lessThan (Comparable other) { if (student_id < ((Student)other).student_id) return true; else return false; } public boolean equals (Student other) { if (student_id == other.student_id) return true; else return false; } public void display () { System.out.print(student_id+" "+student_class+" "+numDesired+" "+ numChoices+" "+numEnrolled+" "); for (int i=0; i t[i] || i == 9) { result = false; break; } } return result; } public boolean equals (Course other) { if (course_name.equals(other.course_name)) return true; else return false; } public void display () { System.out.println(course_name+" "+course_times+" "+capacity+" "+ enrollment+" "+rejections+" "+same_as+" "+title_instructor); } } public class Statistics { public int num_courses = 0; public int num_students = 0; public int[] wanting = {0,0,0,0,0}; // no. of students wanting 0, 1, 2, 3, and 4 courses public int[] getting = {0,0,0,0,0}; // no. of students getting 0, 1, 2, 3, and 4 courses public int time_rejections = 0; // no. of rejections for time conflicts public int capacity_rejections = 0; // no. of rejections for class capacity exceeded public int load_time = 0; // total milliseconds to load classes data structure public int register_time = 0; // total milliseconds to register all students } public class Register { public static void getCourse (ReadStream r, Course a_course) { a_course.course_name = r.readString() + r.readString(); a_course.course_times = r.readString(); a_course.capacity = r.readInt(); a_course.same_as = r.readLine(); if (((a_course.same_as).substring(0,1)).equals("=")) a_course.same_as = (a_course.same_as).substring(2); else { a_course.title_instructor = a_course.same_as; a_course.same_as = ""; } } public static void getCard (ReadStream r, Student a_card) { a_card.student_id = r.readInt(); a_card.student_class = r.readInt(); a_card.numDesired = r.readInt(); a_card.numChoices = r.readInt(); a_card.student_choices.clear(); // clear previous student's choices for (int i=0; i