J Ex
J Ex
1. Packages;
invetory has bookstore.java, books.java, category.java and all category classes(fiction, non-fiction,
mystery)
user auto generated id, firstname, lastname, address, phone. implement two child classes
namely(customer and administrator classes) with appropriate distinct fields e.g administrators must
have login privileges(username, role, password)and customers may further have credit points
attained at every purchase and will determine discounts in further purchases.
3. Book Class;
create a book class that represents a book with attributes such as autogenerated id, title, author,
price and isbn. implement proper encapsulation for these attributes.
4. Category Class;
create a category class that represents a category of books e.g (fiction, non-fiction, mystery)
use inheritance to ensure that each category inherits common attributes from parent class such as
name and description.
5.Bookstore Class;
create a bookstore class that manages the collection of books available for purchase
implement a method to add books to the store's inventory, taking into consideration quantities of
books stored.
implement a method to search for books by title or author withing specific category.
allow store administrators to manage the inventory, adding and removing books.
6. Shopping Cart;
design a shopping cart class that allows customers to add and remove a book.
the cart must have an autogenerated id, customer Id, store ID and seller Id.
it must have a list of books selected and their quantities, also, ensure that the shopping cart can
calculate the total cost of the items added.
the cart must invoke methods int he bookstore class to check whether the required quantities to be
purchased are available and reduce the stock when purchases are made.
implement exception handling for scenarios like adding duplicate books to the shopping cart or
searching for a book that doesnt exist.
utilize abstraction to hide the internal implementation details of the book class while providing a
public interface to access its attributes.
Guidelines:
start by creating a class diagram that outlines the relationship between classes and their attribute
methods.
this.title = title;
this.author = author;
this.pages = pages;
this.price = price;
return title;
this.title = title;
return author;
this.author = author;
return pages;
this.pages = pages;
}
return price;
this.price = price;
// Constructor
this.name = name;
this.email = email;
return name;
this.name = name;
}
return email;
this.email = email;
return categories;
this.categories = categories;
categories.add(category);
categories.remove(category);
// Constructor
this.name = name;
this.description = description;
return name;
this.name = name;
return description;
this.description = description;