About Lesson
Purpose of the Class Diagram
The class diagram represents the static structure of the system. It describes the classes, their attributes, methods, and the relationships (associations, dependencies, aggregations) between them.
Key Classes and Their Descriptions
1. User (Abstract Class)
Attributes:
- userId: String
- name: String
- email: String
- password: String
Methods:
- login()
- logout()
- updateProfile()
This acts as the base class for Customer, Seller, and Admin.
2. Customer (extends User)
Attributes:
- addressList: List<Address>
- cart: Cart
Methods:
- addToCart(product)
- placeOrder()
- viewOrderHistory()
- writeReview(product, review)
3. Seller (extends User)
Attributes:
- storeName: String
- productList: List<Product>
Methods:
- addProduct(product)
- updateInventory(product)
- viewOrders()
4. Admin (extends User)
Attributes:
- adminLevel: int
Methods:
- approveSeller(seller)
- blockUser(userId)
- manageCategories()
5. Product
Attributes:
- productId: String
- name: String
- description: String
- price: double
- stockQuantity: int
- rating: double
Methods:
- updateStock()
- calculateDiscount()
6. Cart
Attributes:
- cartId: String
- items: List<CartItem>
Methods:
- addItem(product, quantity)
- removeItem(productId)
- calculateTotal()
7. CartItem
Attributes:
- product: Product
- quantity: int
8. Order
Attributes:
- orderId: String
- orderDate: Date
- customer: Customer
- items: List<OrderItem>
- status: String
- totalAmount: double
Methods:
- updateStatus()
- cancelOrder()
9. OrderItem
Attributes:
- product: Product
- quantity: int
- priceAtPurchase: double
10. Payment
Attributes:
- paymentId: String
- amount: double
- paymentDate: Date
- paymentMethod: String
Methods:
- processPayment()
- refundPayment()
11. Delivery
Attributes:
- deliveryId: String
- orderId: String
- deliveryStatus: String
- estimatedDeliveryDate: Date
Methods:
- updateStatus()
12. Review
Attributes:
- reviewId: String
- rating: int
- comment: String
- customer: Customer
- product: Product
Methods:
- editReview()
- deleteReview()
Relationships
Customer
usesCart
and placesOrder
Order
hasOrderItems
and is associated withPayment
andDelivery
Product
is managed bySeller
and reviewed byCustomer
User
is the base class forCustomer
,Seller
, andAdmin
Cart
containsCartItems
, each linked to aProduct