import structure.*; import com.mw.io.*; import java.io.*; // This program prepares files for the registration project, lab 10 public class Student implements Comparable { public int student_id; public int student_class; public int student_numDesired; public int student_numChoices; public Vector student_choices; // first, second, and third choices for up to 4 courses public Student(int id, int cl) { student_id = id; student_class = cl; student_choices = new Vector(); student_numDesired = 0; // number of courses on the first line of the card student_numChoices = 0; // total number of courses provided on the card } 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 class Dept implements Comparable { public int dept_num; public String dept_name; public Dept(int num, String name) { dept_num=num; dept_name=name; } public boolean lessThan (Comparable other) { if (dept_num < ((Dept)other).dept_num) return true; else return false; } public boolean equals (Dept other) { if (dept_num == other.dept_num) return true; else return false; } } public class RegFiles { public static String translate(int num, Vector depts) { int i; String n = ""; for (i=0; i 0) { s = ((Student)students.elementAt(i)).student_id + " " + ((Student)students.elementAt(i)).student_class + " " + ((Student)students.elementAt(i)).student_numDesired + " " + ((Student)students.elementAt(i)).student_numChoices + " "; if (i<30) System.out.print(s); pw.print(s); for (int jj=0; jj<((Student)students.elementAt(i)).student_choices.size(); jj++) { s = (((Student)students.elementAt(i)).student_choices).elementAt(jj) + " "; if (i<30) System.out.print(s); pw.print(s); } if (i<30) System.out.println(); pw.println(); } } pw.close(); } catch (IOException e) { System.err.println(e); return; } } }