0% found this document useful (0 votes)
7 views1 page

Files-2

Uploaded by

swarajya laxmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Files-2

Uploaded by

swarajya laxmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

3.

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:

- Add a new patient record to the file


- Remove a patient record from the file
- Search for a patient record by name or ID
- Display all patient records in the file sorted by their age
- Display all patient records in the file sorted by their diagnosis

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:

- Add a new student record to the file


- Remove a student record from the file
- Search for a student record by name or ID
- Display all student records in the file sorted by their GPA
- Display all student records in the file sorted by their year of graduation

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.

You might also like