0% found this document useful (0 votes)
6 views

JAVA TASK (Collections) HARD

The document outlines various programming tasks for creating management systems using different data structures in Java. It includes specifications for a Library Management System (ArrayList), Task Management System (LinkedList), Student Enrolment System (HashSet), Playlist Management System (LinkedHashSet), Event Management System (TreeSet), Inventory Management System (HashMap), Order Management System (LinkedHashMap), and Contact Management System (TreeMap). Each task specifies the required classes, fields, methods, and a main method for demonstration.

Uploaded by

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

JAVA TASK (Collections) HARD

The document outlines various programming tasks for creating management systems using different data structures in Java. It includes specifications for a Library Management System (ArrayList), Task Management System (LinkedList), Student Enrolment System (HashSet), Playlist Management System (LinkedHashSet), Event Management System (TreeSet), Inventory Management System (HashMap), Order Management System (LinkedHashMap), and Contact Management System (TreeMap). Each task specifies the required classes, fields, methods, and a main method for demonstration.

Uploaded by

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

COLLECTIONS (Hard)

(A) LIST:
(1) ArrayList - Task: Library Management System.

Objective: Create a library management system using ArrayList to manage books. Implement features to add, remove, and search for books
by title.

Requirements

1. Create a class Book:

o Fields: String title, String author, String isbn.

o Constructor to initialize these fields.

o toString() method to display book information.

2. Create a class Library:

o Use an ArrayList<Book> to store a collection of books.

o Methods to:

▪ Add a book.

▪ Remove a book by ISBN.

▪ Search for a book by title.

▪ Display all books in the library.

3. Implement a main method to demonstrate adding, removing, searching, and displaying books.

(2) LinkedList - Task: Task Management System

Objective: Create a task management system using LinkedList to manage tasks. Implement features to add, remove, update, and display
tasks.

Requirements

1. Create a class Task:

o Fields: String description, String dueDate, boolean completed.

o Constructor to initialize these fields.

o toString() method to display task information.

2. Create a class TaskManager:

o Use a LinkedList<Task> to store a collection of tasks.

o Methods to:

▪ Add a task.

▪ Remove a task by index.

▪ Mark a task as completed by index.

▪ Display all tasks.

3. Implement a main method to demonstrate adding, removing, updating, and displaying tasks.
(B) SET:
(1) HashSet - Task: Student Enrolment System

Objective: Create a student enrolment system using HashSet to manage enrolled students. Implement features to add students, remove
students, check if a student is enrolled, and display all enrolled students.

Requirements

1. Create a class Student:

o Fields: String name, int id.

o Constructor to initialize these fields.

o Override equals() and hashCode() methods to ensure students are compared by their ID.

o toString() method to display student information.

2. Create a class EnrollmentSystem:

o Use a HashSet<Student> to store a collection of enrolled students.

o Methods to:

▪ Add a student.

▪ Remove a student by ID.

▪ Check if a student is enrolled by ID.

▪ Display all enrolled students.

3. Implement a main method to demonstrate adding, removing, checking, and displaying enrolled students.

(2) LinkedHashSet - Task: Playlist Management System

Objective: Create a playlist management system using LinkedHashSet to manage songs. Implement features to add songs, remove songs,
check if a song is in the playlist, and display all songs in the order they were added.

Requirements

1. Create a class Song:

o Fields: String title, String artist.

o Constructor to initialize these fields.

o Override equals() and hashCode() methods to ensure songs are compared by their title and artist.

o toString() method to display song information.

2. Create a class Playlist:

o Use a LinkedHashSet<Song> to store a collection of songs.

o Methods to:

▪ Add a song.

▪ Remove a song by title and artist.

▪ Check if a song is in the playlist by title and artist.

▪ Display all songs.

3. Implement a main method to demonstrate adding, removing, checking, and displaying songs in the playlist.
(3) TreeSet - Task: Event Management System

Objective: Create an event management system using TreeSet to manage events. Implement features to add events, remove events, check
if an event is present, and display all events in sorted order.

Requirements

1. Create a class Event:


o Fields: String name, String date (in the format "YYYY-MM-DD").
o Constructor to initialize these fields.
o Implement Comparable<Event> to ensure events are sorted by date.
o Override equals() and hashCode() methods to ensure events are compared by their name and date.
o toString() method to display event information.
2. Create a class EventManager:
o Use a TreeSet<Event> to store a collection of events.
o Methods to:
▪ Add an event.
▪ Remove an event by name and date.
▪ Check if an event is present by name and date.
▪ Display all events in sorted order.
3. Implement a main method to demonstrate adding, removing, checking, and displaying events.

(C) MAP:
(1) HashMap - Task: Inventory Management System

Objective: Create an inventory management system using HashMap to manage items and their quantities. Implement features to add
items, update quantities, remove items, and display all items with their quantities.

Requirements

1. Create a class Item:

o Fields: String name, double price.

o Constructor to initialize these fields.

o Override equals() and hashCode() methods to ensure items are compared by their name.

o toString() method to display item information.

2. Create a class Inventory:

o Use a HashMap<Item, Integer> to store items and their quantities.

o Methods to:

▪ Add an item with a specified quantity.

▪ Update the quantity of an existing item.

▪ Remove an item.

▪ Display all items with their quantities.

3. Implement a main method to demonstrate adding, updating, removing, and displaying items in the inventory.
(2) LinkedHashMap - Task: Order Management System

Objective: Create an order management system using LinkedHashMap to manage customer orders. Implement features to add orders,
remove orders, check if an order is present, and display all orders in the order they were added.

Requirements

1. Create a class Order:

o Fields: String orderId, String customerName, double amount.

o Constructor to initialize these fields.

o Override equals() and hashCode() methods to ensure orders are compared by their orderId.

o toString() method to display order information.

2. Create a class OrderManager:

o Use a LinkedHashMap<String, Order> to store a collection of orders, with the orderId as the key.

o Methods to:

▪ Add an order.

▪ Remove an order by orderId.

▪ Check if an order is present by orderId.

▪ Display all orders in the order they were added.

3. Implement a main method to demonstrate adding, removing, checking, and displaying orders.

(3) TreeMap - Task: Contact Management System

Objective: Create a contact management system using TreeMap to manage contacts. Implement features to add contacts, remove
contacts, check if a contact is present, and display all contacts in sorted order by name.

Requirements

1. Create a class Contact:

o Fields: String name, String phoneNumber, String email.

o Constructor to initialize these fields.

o Override toString() method to display contact information.

2. Create a class ContactManager:

o Use a TreeMap<String, Contact> to store a collection of contacts, with the name as the key.

o Methods to:

▪ Add a contact.

▪ Remove a contact by name.

▪ Check if a contact is present by name.

▪ Display all contacts in sorted order by name.

3. Implement a main method to demonstrate adding, removing, checking, and displaying contacts.

--- xxx ---

You might also like