Page 387 - Computer_Science_F5
P. 387
Methods: checkout(),
Computer Science Solution: (ii) Class: User
return_book().
Stage One: Planning the project
1. Define objectives
(a) Purpose: Develop a system
Attributes: name, user_id,
FOR ONLINE READING ONLY
to manage library operations,
including book checkouts, returns, checked_out_books.
and inventory. Methods: checkout_book(),
(b) Goals: return_book().
(i) Allow users to search for (iii) Class: Library
books. Attributes: books, users.
(ii) Manage book checkouts and Methods: add_book(),
returns. remove_book(), search_
(iii) Track inventory and user book().
accounts.
Stage Two: Designing classes and
2. Identify requirements relationships
(a) Features:
(i) User authentication. 1. Class diagrams
(ii) Search and browse books. Visual representation:
(iii) Checkout and return books. (i) Library contains multiple Book
(iv) Manage user accounts and and User objects.
book inventory. (ii) User interacts with Book through
(b) Data inputs: checkout() and return_book()
(i) Book details (title, author, methods.
ISBN, availability).
(ii) User details (name, ID, 2. Key considerations
checked-out books). (a) Encapsulation:
(i) Keep book details private
(c) Outputs: within the Book class.
(i) User-friendly interface for (ii) Manage user details through
library staff and users. the User class methods.
(ii) Reports on book availability (b) Inheritance:
and user activities.
Not used in this simple scenario,
3. Create a design document but could be expanded (e.g.,
(a) Outline classes different types of users).
(i) Class: Book (c) Composition:
Attributes: title, author, ISBN, Library class composed of lists
available_copies. of ‘Book” and ‘User’ objects.
378
for Advanced Secondary Schools
Computer Science Form 5.indd 378 23/07/2024 12:34

