import java.util.*; import java.io.*; public class Assignment8 { public static void main( String args[] ) throws IOException { StudentRecord student; StudentRecord secondStudent; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); student = new StudentRecord("1234567889"); System.out.println(" The student ID is " + student.getID()); System.out.print(" Enter first name: "); student.setFirstName(in.readLine()); System.out.print(" Enter last name: "); student.setLastName(in.readLine()); System.out.print(" Enter Address: "); student.setAddress(in.readLine()); System.out.println("The student\'s first name is " + student.getFirstName()); System.out.println("The student\'s last name is " + student.getLastName()); System.out.println(student.toString()); student.setAddress(); System.out.println("The student\'s address has been reset to " + student.getAddress()); System.out.println(" Now for another student record"); // Field declarations for storing the data provided by the user String otherStudentID; String otherStudentFirstName; String otherStudentLastName; String otherStudentAddress; int otherStudentDay; int otherStudentMonth; int otherStudentYear; GregorianCalendar otherStudentTimeModified; System.out.print(" Enter ID number: "); otherStudentID = in.readLine(); System.out.print(" Enter first name: "); otherStudentFirstName = in.readLine(); System.out.print(" Enter last name: "); otherStudentLastName = in.readLine(); System.out.print(" Enter Address: "); otherStudentAddress = in.readLine(); System.out.print(" Enter day: "); otherStudentDay = Integer.parseInt(in.readLine()); System.out.print(" Enter month: "); otherStudentMonth = Integer.parseInt(in.readLine())-1; System.out.print(" Enter year: "); otherStudentYear = Integer.parseInt(in.readLine()); otherStudentTimeModified = new GregorianCalendar(otherStudentYear, otherStudentMonth,otherStudentDay); secondStudent = new StudentRecord(otherStudentID, otherStudentFirstName, otherStudentLastName, otherStudentAddress, otherStudentTimeModified); GregorianCalendar tm = secondStudent.getTimeModified(); System.out.println(" Time modified for the second student is " + (tm.get(Calendar.MONTH)+1) + "/"+ tm.get(Calendar.DAY_OF_MONTH) + "/" + tm.get(Calendar.YEAR)); student.synchronize(secondStudent); System.out.println(student.toString()); System.out.println(secondStudent.toString()); } }