An open API service indexing awesome lists of open source software.

https://github.com/furk4nbulut/e-commerce-application

Java e-commerce app built for CSE 1124 Object Oriented Programming course, showcasing classes for user, product, order, and credit card with full object-oriented structure and test cases.
https://github.com/furk4nbulut/e-commerce-application

java oop

Last synced: about 11 hours ago
JSON representation

Java e-commerce app built for CSE 1124 Object Oriented Programming course, showcasing classes for user, product, order, and credit card with full object-oriented structure and test cases.

Awesome Lists containing this project

README

          

# ๐Ÿ›’ E-Commerce Application

Object Oriented Programming - Homework Project
**Manisa Celal Bayar University**
Faculty of Engineering - Computer Engineering
**2022-2023 Spring Semester**

> **Student:** Furkan Bulut
> **Student No:** 210316011

---

## ๐Ÿ“Œ Project Overview

This project simulates a basic **e-commerce application** using Java and Object-Oriented Programming principles such as encapsulation, constructors, method overloading, and data hiding. The system models Users, Products, Orders, and Credit Cards, supporting stock tracking, ordering, and payment processing functionalities.

---

## ๐Ÿ“‚ Contents

- [UML Diagram](#-uml-diagram)
- [User Class](#-user-class)
- [Product Class](#-product-class)
- [Order Class](#-order-class)
- [CreditCard Class](#-creditcard-class)
- [Main/Test Class](#-maintest-class)

---

## ๐Ÿ—‚ UML Diagram

> A UML class diagram is provided in the project folder that visualizes class relationships.

---

## ๐Ÿ‘ค User Class

The `User` class represents a customer in the system.

### โœ… Attributes:
- `fullName`, `email`, `password`, `phone`, `address`, `workAddress` (private `String`)
- `ArrayList` for favorite products and orders

### ๐Ÿ›  Constructor:
Initializes user details.

### ๐Ÿ”ง Methods:
- `addProductToFavorites(Product product)`
- `removeProductFromFavorites(Product product)`
- `addProductToOrder(Product product)`
- `removeProductFromOrder(Product product)`
- Getters and Setters for all fields

---

## ๐Ÿ“ฆ Product Class

The `Product` class defines the items available for purchase.

### โœ… Attributes:
- `productName`, `productDescription`, `productCategory`, `productBrand`, `productColor`, `productSize`, `productPrice`, `productStock` (private)

### ๐Ÿ›  Constructor:
Initializes product details.

### ๐Ÿ”ง Methods:
- `boolean checkStock()`
Checks stock and returns `true` if available.
- `void reduceStock()`
Decreases the product's stock.
- `String toString()`
Returns a formatted product description.

---

## ๐Ÿงพ Order Class

The `Order` class manages the shopping process and interactions.

### โœ… Attributes:
- `User user`
- `Product product`
- `CreditCard creditCard`

### ๐Ÿ›  Constructor:
Assigns ordering entities.

### ๐Ÿ”ง Methods:
- `void addToOrder()`
Adds product to order if stock is available.
- `void processPayment()`
Checks balance, deducts payment, reduces stock.

---

## ๐Ÿ’ณ CreditCard Class

The `CreditCard` class models user payment information.

### โœ… Attributes:
- `cardNumber`, `expirationDate`, `securityCode`, `cardBalance`
- `User user`

### ๐Ÿ›  Constructor:
Initializes the card and its user.

### ๐Ÿ”ง Methods:
- Getters and Setters for all private fields

---

## ๐Ÿงช Main/Test Class

Used to test and simulate the application flow.

### ๐Ÿ” Actions:
- Create two `User` instances
- Create two `CreditCard` instances
- Create two `Product` instances
- Test methods like adding to favorites, checking stock, placing an order, and processing payment

---

## ๐Ÿ–ฅ Sample Console Output

The test class demonstrates the functionality through printed messages including stock checks, successful or failed order messages, and balance updates.

---

## ๐Ÿ“Œ Note

All classes follow **OOP principles**:
- Encapsulation with `private` variables
- Use of **constructors** for initialization
- **ArrayList** is used to store collections of items
- **Getter and Setter** methods to access and modify data safely

---

## ๐Ÿ“Ž Author

**Furkan Bulut**
> Computer Engineering Student
> Manisa Celal Bayar University