{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Main - import java.io import java.util i public class Main...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: import java.io.*; import java.util.*; i public class Main { public static void main(String args) { Student students = new Student[10]; Course courses = new Course[10]; courses[0] = new Course("cis3022", "java1", "MWF-2"); courses[1] = new Course("cis3023", "java2", "MWF-3"); courses[2] = new Course("cis3020", "java", "MWF-5"); courses[3] = new Course("cot3100", "discrete math", "TR-5"); students[0] = new Student("Nathan", "Vanderkraats", "111-11-1111", "[email protected]", 4.0); students[1] = new Student("Shayan", "Javed", "111-11-1112","[email protected]", 3.0); students[2] = new Student("Ruijin", "Wu", "111-11-1113", "[email protected]", 3.5); students[3] = new Student("Wenjie", "Yuan", "111-11-1114","[email protected]", 4.0); students[4] = new Student("Karthik", "Gurumoorthy", "111-11-1115", "[email protected]", 3.8); " students[0].addCourse(courses[0]); students[0].addCourse(courses[3]); students[1].addCourse(courses[1]); students[2].addCourse(courses[2]); students[3].addCourse(courses[0]); s //Text File I/O writeToTextFile(students, courses); Student studentsRead = new Student[10]; S Course coursesRead = new Course[10]; readFromTextFile(studentsRead, coursesRead); System.out.println("Info read from text file"); for (int i = 0; i < studentsRead.length; i++ ) if (studentsRead[i] != null) System.out.println(studentsRead[i]); for (int i = 0; i < coursesRead.length; i++ ) if (coursesRead[i] != null) System.out.println(coursesRead[i]); // Object File I/O : option 1 writeToObjectFile1(students, courses); w Student studentsRead1 = new Student[10]; Course coursesRead1 = new Course[10]; C readFromObjectFile1(studentsRead1, coursesRead1); System.out.println("\n\nInfo read from object file -- option 1: \n"); S coursesRead1[0].setTime("TR-6"); for (int i = 0; i < studentsRead1.length; i++ ) if (studentsRead1[i] != null) System.out.println(studentsRead1[i]); for (int i = 0; i < coursesRead1.length; i++ ) if (coursesRead1[i] != null) System.out.println(coursesRead1[i]);if (coursesRead1[i] !...
View Full Document

{[ snackBarMessage ]}

Page1 / 6

Main - import java.io import java.util i public class Main...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online