0% found this document useful (0 votes)
9 views6 pages

NexTrend E-Commerce

The document describes a simple e-commerce product catalog system with a hierarchy of categories, subcategories, products, and variants. It includes a base class 'Product' and subclasses 'Electronics' and 'Clothing', each with specific attributes and methods for displaying product information. The main class 'ECommerceCatalog' manages the creation and display of product lists, formatted for an e-commerce platform named NexTrend.

Uploaded by

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

NexTrend E-Commerce

The document describes a simple e-commerce product catalog system with a hierarchy of categories, subcategories, products, and variants. It includes a base class 'Product' and subclasses 'Electronics' and 'Clothing', each with specific attributes and methods for displaying product information. The main class 'ECommerceCatalog' manages the creation and display of product lists, formatted for an e-commerce platform named NexTrend.

Uploaded by

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

Source Code (For Direct Output):

Output:
Source Code (For User-Input):
Output:
Description
E-commerce Product Catalog:
Domain: Retail and E-commerce
Hierarchy: Category > Subcategory > Product > Variant
Objects: Products can have attributes like price, description, and stock level.

Overview
The code represents a simple e-commerce product catalog system. It defines a base class
Product and two subclasses, Electronics and Clothing, to represent different types of products.
The main class, ECommerceCatalog, demonstrates how to create and display a list of products.

Class Breakdown

1. Product Class
- Attributes:
- name: The name of the product.
- price: The price of the product in Philippine Pesos.
- stockLevel: The current stock level of the product.
- description: A description of the product.
- Constructor: Initializes the product's attributes.
- Methods:
- displayProductInfo(): Displays the product's details, including name, price, stock level, and
description.
- updateStock(int quantity): Updates the stock level by adding the specified quantity and
prints the updated stock level.

2. Electronics Class
- Inherits from: Product
- Additional Attribute:
- warrantyPeriod: The warranty period for the electronic product.
- Constructor: Initializes the electronics-specific attributes and calls the superclass constructor
to set common attributes.
- Method:
- displayElectronicsInfo(): Displays the product's details along with the warranty period by
calling the displayProductInfo() method from the `Product` class.

3. Clothing Class
- Inherits from: Product
- Additional Attribute:
- size: The size of the clothing item.
- Constructor: Initializes the clothing-specific attributes and calls the superclass constructor to
set common attributes.
- Method:
- displayClothingInfo(): Displays the product's details along with the size by calling the
displayProductInfo() method from the `Product` class.

4. ECommerceCatalog Class (Main Class)


- Main Method: This is where the program execution begins.
- Product Arrays:
- An array of Electronics objects is created, each initialized with specific attributes (name,
price, stock level, description, and warranty period).
- An array of Clothing objects is created similarly.
- Display Menu:
- The program prints a header for the e-commerce platform named NexTrend.
- It lists all electronics products with their names, prices, and stock levels.
- It lists all clothing products in the same format.
- Output Formatting: The printf method is used to format the output, ensuring that prices are
displayed with two decimal places.

Here is the inheritance chart in Java for an e-commerce real-world domain

- Product is the base class that contains common attributes and methods for all products.
- Electronics and Clothing are subclasses that inherit from the Product class.
- Each subclass has its own specific attributes and methods in addition to those inherited from the
Product class.

You might also like