Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Assignment 3 Question

Oop notes cui sahiwal

Uploaded by

khanamazra82
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment 3 Question

Oop notes cui sahiwal

Uploaded by

khanamazra82
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

COMSATS University Islamabad, Sahiwal

Campus
COMSATS Road, Off G.T. Road, Sahiwal. Tel: 040-4305001-05
Department of ECE

Course Title: OOP Course Code: CSC241 Credit Hours: (3,1)


Course Instructor: Mr. Hamza Arif Program Name: BSEE
Semester: 3rd Section: A Session: FA23 Date: October 14, 2024
CLOs Addressed CLO3-C3-PLO8 Maximum Marks: 10

Assignment#3
Question no 1 :- Compute the following concepts in java

1. Build a Classroom Manager using ArrayList

Objective: Develop a simple student management system using ArrayList and object-oriented principles.

Instructions:

1. Create a Classroom class that holds an ArrayList<String> to store student names.


2. Implement these methods:
o addStudent(String name): Adds a student's name to the list.
o removeStudent(String name): Removes a student by name if found.
o hasStudent(String name): Returns true if the student is in the list.
o listStudents(): Prints all student names.
3. In the main method:
o Instantiate a Classroom object.
o Add a few students, remove one, and check if a name exists.
o Display the list of students.

2. Library Management System Using ArrayList

Objective: Develop a simple library management system where users can add, remove, check for, and list
books using ArrayList for storing book names.

Instruction:
1. Create the Library class: This class will hold an ArrayList<String> to store book titles.

2. Methods to Implement:

o addBook(String title): Adds a book’s title to the list.


o removeBook(String title): Removes a book by its title if found.
o hasBook(String title): Checks if a book is in the list and returns a boolean (true if the book is in the
library).
o listBooks(): Prints all book titles in the library.

3. Main Method:

In the main method:

o Instantiate a Library object.


o Add a few books, remove one, check if a book exists, and display the list of books.

Note: - The deadline for submitting the assignment. 18th October 2024. Please ensure that you submit
your completed assignment in hard form on 18th October 2024. Submissions made after the deadline will
not be accepted.

You might also like