Employee Record System using
Serialization
Java Mini Project
Team Members :
V Charishma Sai
T Mounika
V Vyshnavi
R Tejasri
Thanuja Murali
CONTENTS
1. Problem Statement 2. Input Format
3. Output Format 4. Sample Input
5. Sample Output 6. Code in Java
1. Problem Statement
Create an employee record system that allows adding employee
details and serializes them to a file. Deserialize to display all saved
employee records.
2. Input Format
Employee ID, Name, Salary (repeatable)
Command to serialize
Command to deserialize and view records
3. Output Format
1
Confirmation of serialization
All employee records printed after deserialization
Code in Java
import [Link].*;
import [Link].*;
class Employee implements Serializable {
int id;
catch (IOException | ClassNotFoundException e) { [Link](); } } public static void main(String[]
args) { addEmployee(101, "John", 50000); addEmployee(102, "Alice", 60000); serialize();
deserialize(); }}
String name;
double salary;
public Employee(int id, String name, double salary)
{
[Link] = id;
[Link] = name;
[Link] = salary;
}}
public class EmployeeRecordSystem
static List employeeList = new ArrayList<>();
public static void addEmployee(int id, String name, double salary) {
[Link](new Employee(id, name, salary));
}
public static void serialize() {
try (FileOutputStream fileOut = new FileOutputStream("[Link]");
ObjectOutputStream out = new ObjectOutputStream(fileOut)) {
[Link](employeeList);
[Link]("Employee records saved successfully.");
catch (IOException e)
[Link]();
}
public static void deserialize() {
try (FileInputStream fileIn = new FileInputStream("[Link]");
ObjectInputStream in = new ObjectInputStream(fileIn)) {
employeeList = (List) [Link]();
[Link]("Employee records loaded:");
for (Employee emp : employeeList) {
[Link]("ID: " + [Link] + ", Name: " + [Link] + ", Salary: " + [Link]);
}
catch (IOException | ClassNotFoundException e)
[Link]();
public static void main(String[] args) {
addEmployee(101, "John", 50000);
addEmployee(102, "Alice", 60000);
serialize();
deserialize();
}
Thank You