Question: In Java - Purpose: Understand I/O using Streams and Files Description: A college keeps records of all professors and students in a file people.txt. Each
In Java - Purpose: Understand I/O using Streams and Files
Description: A college keeps records of all professors and students in a file "people.txt". Each line starts with a title (Professor/Student) followed by first name, last name, and a department for a professor or a degree for a student as follows:
"people.txt": Professor Blake Paul Science Student Mike Smith Math Professor Brian McGinty SocialWork Student Rodney James History Professor Blaise Pascal Physics Student Julia Roberts Masters Professor Feida Nyla Philosophy Student Kyle Turpin Geology
Create two classes: Professor and Student with applicable fields. Write a program that will read from file "people.txt", scan every line, create the necessary object (either a student or professor) and add it to one of the two arrays ( or lists): students and professors.
Once the lists/arrays are ready: - print both to standard output - serialize them using object streams into "professors.ser" and "students.ser"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
