Files
Files
Task:
Operations:
- Add book: prompt the user for book information and add it to the HashMap and
TreeSet
- Remove book: prompt the user for a book title and remove it from the HashMap and
TreeSet
- Search book: prompt the user for a book title and display its information if
found
- Sort books: sort the books in the TreeSet by title, author, publication year, and
genre
- Display books: display all books in the TreeSet
Java Question:
Write a Java program that implements the above scenario and operations. Use the
following classes:
- Book: to represent a book with title, author, publication year, and genre
- Library: to manage the book collection using HashMap and TreeSet
Note: Use appropriate methods and variables to implement the operations. Use the
Scanner class to get user input.
-----------------------------------------------------------------------------------
--------------------------------
2. Problem Statement:
You are the HR manager of a company. You need to manage the employees' data. Each
employee has a name, ID, department, job title, and a salary. You need to store the
employees in a data structure and perform the following operations:
Requirements:
- Use an enumeration for the departments (e.g. Sales, Marketing, IT, etc.)
- Use a Comparator to sort the employees by their salaries and job titles
- Use auto-boxing to convert the salaries to Double objects
- Use a Scanner to read input from the user
- Use a Map to store the employees, where the key is the employee ID and the value
is the employee object
- Use a List to store the employees in the order they were added
- Use a Set to store the unique job titles
- Use a PriorityQueue to store the top 5 highest-paid employees
- Use a Deque to store the employees in a queue for processing
- Use an Iterator to access the employees in the collection
- Use the sorting operations to sort the employees by their salaries and job titles