Files-2
Files-2
Problem Statement:
You are the administrator of a hospital's patient database. You need to manage the
patients' records, which include their name, ID, age, and diagnosis. You need to
store the patients' records in a file and perform the following operations:
Requirements:
- Use a Patient class to represent the patient records, which implements the
Serializable interface
- Use a File class to create a file named "patients.dat" to store the patient
records
- Use FileInputStream and FileOutputStream to read and write the patient records to
the file
- Use ObjectInputStream and ObjectOutputStream to read and write the patient
objects to the file
- Use serialization and deserialization to store and retrieve the patient objects
- Use a Comparator to sort the patient objects based on their age and diagnosis
- Use the sorting operation to sort the patient records in the file
-----------------------------------------------------------------------------------
-----------------------
4. Problem Statement:
You are the administrator of a university's student database. You need to manage
the student records, which include the student's name, ID, GPA, major, and year of
graduation. You need to store the student records in a file and perform the
following operations:
Requirements:
- Use a Student class to represent the student records, which implements the
Serializable interface
- Use a File class to create a file named "students.dat" to store the student
records
- Use FileInputStream and FileOutputStream to read and write the student records to
the file
- Use ObjectInputStream and ObjectOutputStream to read and write the student
objects to the file
- Use serialization and deserialization to store and retrieve the student objects
- Use a Comparator to sort the student objects based on their GPA and year of
graduation
- Use the sorting operation to sort the student records in the file.