Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

First-Year Shopping Cart Project

This project fulfills the requirements for the "Application Development Using Design Concepts" assignment via a Basic E-Commerce interface.

Instructions to Run

  1. Open up the terminal in this folder (e:\live site).
  2. Install packages (if you haven't) by running npm install express cors.
  3. Start the server by running node server.js.
  4. Open your browser and go to http://localhost:3000.

Testing the Accounts

The system contains pre-registered dummy accounts for testing login functionality:

  • Admin: Username admin, Password admin123
  • Customer: Username user, Password pass123

1. Application Design (OOP Principles) - 3 Marks

This app uses standard Object-Oriented Programming principles inside server.js:

  • Classes: Product, User, Admin, Customer.
  • Objects: We instantiate items securely new Product(1, "Laptop", 500, 10).
  • Encapsulation: Instead of modifying variables directly from the array, we use the reduceStock() method of the Product class securely.
  • Inheritance: Both Admin and Customer classes extend the User class to inherit login traits (username and password).

2. UML Diagrams - 3 Marks

1. Class Diagram

classDiagram
    class User {
        +username: String
        +password: String
    }
    
    class Admin {
        +role: String
    }
    
    class Customer {
        +role: String
        +cart: List~Product~
        +addToCart(Product) Boolean
    }

    class Product {
        +id: Number
        +name: String
        +price: Number
        +stock: Number
        +reduceStock(Number) Boolean
    }

    User <|-- Admin : Extends
    User <|-- Customer : Extends
Loading

2. Use Case Diagram

usecaseDiagram
    actor Admin
    actor Customer

    rectangle "Shopping Cart Application" {
        usecase "System Login" as UC1
        usecase "View Inventory" as UC2
        usecase "View Catalog" as UC3
        usecase "Add to Cart" as UC4
    }

    Admin --> UC1
    Admin --> UC2
    
    Customer --> UC1
    Customer --> UC3
    Customer --> UC4
Loading

3. Demonstration & 4. Presentation

The system demonstrates logical flows switching between Admin and User scopes dynamically based on who is logged in. It's written entirely in standard <script> tags and basic HTML layout representing a standard first-year delivery package.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages