1. Create a Java program to manage employees and their departments.
Define an Employee class with
attributes such as id, name, salary, deptName and organization.
Implement operations to handle employee-related queries by creating 10 employees with at least 3
departments.
Tasks:
a) Calculate the average salary of employees in each department.
b) Sort employees by name
c) Find the top 3 highest-paid employees
d) Display employees earning >=50000 in each department.
2. Create a multithreaded Java program that performs three distinct tasks using separate threads. Each
thread will generate random numbers and perform calculations based on those numbers. The tasks are
as follows:
A. Prime Number Generator Thread:
a. Generate a random number between 101 and 999.
b. Find all prime numbers up to that generated number.
c. Calculate the sum of all prime numbers found and print the results.
B. Square Calculator Thread:
d. Generate a random number between 11 and 99.
e. Calculate and print the squares of all integers from 1 up to that generated number.
C. Multiples of 5 Finder Thread:
f. Create a list of 100 random numbers between 1 and 500.
g. Find and print all the numbers from this list that are multiples of 5.
3. Create a Java program that performs the following tasks related to file handling and serialization.
File Analysis:
The program should read a source code file of the program itself and perform the following analyses:
a) Count the total number of words, lines and characters in the file.
b) Identify the longest word in the file and its length.
Write the results of the analysis to the [Link] file appending your name and roll number
Book Management:
Define a Book class that contains details about a book, including attributes such as ISBN, title, author,
and price. Price should not be serialized.
a) Implement serialization to save a list of Book objects to a file.
b) Implement deserialization to read the list of Book objects from the file and display their
details.
4. Develop a Java program that simulates a basic customer account management system. The program
should include user-defined exceptions to handle specific error conditions when managing customer
accounts.
Classes:
a. Customer Class: This class represents a customer and contains attributes such as cid, name,
account, and address.
b. Account Class: This class represents a bank account associated with a customer. It should
have attributes like accountNumber, balance, and methods for deposit, withdraw, and getting
the account balance.
c. Address Class: This class represents the customer's address and should include attributes like
street, city, state, and pinCode.
d. InsufficientBalanceException: A custom exception that is thrown when an account's balance
goes negative.
Functionality:
● The Account class should throw an InsufficientBalanceException whenever a withdrawal is
attempted that would result in a negative balance.
● The Customer class should manage a customer's information, including their account and
address details.
● Include a method to display the customer's details along with and account and address
information.
● Implement appropriate exception handling to catch and handle InsufficientBalanceException
when it occurs during a withdrawal operation.