Skip to content

About

University Project

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ Java Store Management System

A console-based store management system built in Java β€” featuring inventory control, customer management, and a full shopping cart workflow.


Java Apache Ant NetBeans Last Commit Stars Forks


πŸ“– Table of Contents


πŸ“Œ About

The Java Store Management System is a terminal-based Java application that simulates a retail store backend. It manages an in-memory inventory of items (books, shoes, and games), registers customers, and provides a complete shopping cart workflow from item selection through to checkout.

This project was built as a Java 2 academic project and demonstrates core object-oriented programming principles: inheritance, encapsulation, polymorphism, and clean separation of concerns across classes.


🎬 Demo

Main Menu

-------[ Store Main Menu ]-------
1. Add a new Item to Store.
2. Add a new Customer to Store.
3. Add an item to Customer shopping cart.
4. Remove an item from Customer shopping cart.
5. View the items in Customer shopping cart.
6. End shopping and go to checkout.
7. Empty Customer shopping cart.
8. Modify customer data.
9. Exit the program.
(Enter the Number Twice for Function description)
---------------------------------
Please Enter the number of Operation you want :

Adding an Item

[ Add Item Operation: ]
Please enter the item Number : 101
Please enter the item Name : Java Programming
Please enter the Quantity : 15
Please enter the Price : 29.99
Enter the type of item (B)Book, (s)shoes, (G)Game? : B
Enter the Book title: Java in Action
Enter the Book author name: John Doe
[DONE] > Item added Successfully

Viewing Shopping Cart

The Customer No : 1, The Customer Name : Alice
The current items in the shopping cart :
Item no       Item name       Quantity       Unit price       Total price
101           Java Programming   2             29.99            59.98
                                                     Total price : 59.98

Note: The terminal output uses ANSI color codes β€” yellow for headings, green for success messages, and red for errors. Color rendering depends on your terminal emulator.


✨ Features

Inventory Management

  • Add items to the store with a unique item number, name, quantity, and price
  • Three item types supported: Books (with title and author), Shoes, and Games
  • Inventory quantity is automatically decremented on checkout

Customer Management

  • Register new customers with unique customer IDs and names
  • Modify existing customer number and name
  • Customers are stored in memory for the session

Shopping Cart

  • Add items to any registered customer's cart with quantity validation
  • Remove individual items from the cart
  • View a formatted cart summary with unit prices and totals
  • Empty a customer's cart (also removes the customer from the session)

Checkout

  • Validates stock availability at checkout time
  • Deducts purchased quantities from the store inventory
  • Displays a full itemized receipt with total price

Input Validation

  • Catches InputMismatchException on all numeric inputs β€” the program never crashes on bad input
  • Validates uniqueness of item numbers and customer IDs
  • Rejects negative quantities and prices with clear error messages
  • Prompts (y/n) confirmations with re-prompt on invalid characters

In-App Help System

  • Enter any menu number twice (e.g., 11, 22, 33 …) to print a full description of that operation

πŸ›  Tech Stack

Technology Purpose
Java Core language
Apache Ant Build system
NetBeans Project structure & IDE
java.util.ArrayList In-memory data storage
java.util.Scanner Console input
java.text.DecimalFormat Price formatting
ANSI escape codes Colored terminal output

No external libraries or frameworks are used. The project runs on the Java Standard Library alone.


πŸ› Architecture

The application follows a single-package OOP design with clear class responsibilities:

StoreInfo  (abstract)
    └── JavaProject  (main entry point + shared state)
             β”‚
             β”œβ”€β”€ Items  (inventory item base class)
             β”‚     └── books  (Book subclass with title & author)
             β”‚
             β”œβ”€β”€ Customer  (customer identity + per-customer cart)
             β”‚
             └── ShoppingCart  (all cart & checkout operations)

Key design decisions:

  • JavaProject holds two shared static ArrayList collections β€” Customers and itemsList β€” which act as the in-memory "database" for the session. All other classes import these via static import.
  • StoreInfo is an abstract class whose sole role is to house static help-text methods, keeping descriptive output separate from logic.
  • books extends Items and overrides nothing; it simply adds bookTitle and bookAuthor fields. The item type character 'b' is used at runtime to cast Items references back to books where needed.
  • All data is in-memory only β€” nothing is persisted to disk between runs.

πŸ“ Folder Structure

Java-2-Project/
β”‚
β”œβ”€β”€ src/
β”‚   └── javaproject/
β”‚       β”œβ”€β”€ JavaProject.java     # Main class β€” entry point & main menu
β”‚       β”œβ”€β”€ StoreInfo.java       # Abstract base β€” help text for each operation
β”‚       β”œβ”€β”€ Items.java           # Store item model + AddItem() logic
β”‚       β”œβ”€β”€ books.java           # Book subclass (adds title & author)
β”‚       β”œβ”€β”€ Customer.java        # Customer model + AddCustomer/Modify logic
β”‚       └── ShoppingCart.java    # Cart operations: add, remove, view, checkout, empty
β”‚
β”œβ”€β”€ nbproject/
β”‚   β”œβ”€β”€ build-impl.xml           # NetBeans-generated Ant build implementation
β”‚   β”œβ”€β”€ genfiles.properties      # NetBeans generated files metadata
β”‚   β”œβ”€β”€ project.properties       # Project settings (Java 18, main class, paths)
β”‚   └── project.xml              # NetBeans project type descriptor
β”‚
β”œβ”€β”€ build.xml                    # Apache Ant build script entry point
β”œβ”€β”€ manifest.mf                  # JAR manifest (Main-Class set by Ant at build time)
β”œβ”€β”€ java-Final-Project.pdf       # Project specification / assignment document
└── README.md

βœ… Prerequisites

  • Java Development Kit (JDK) 18 or later
  • Apache Ant 1.9+ (required for the Ant build script)
    • Download: ant.apache.org
    • Or open directly in Apache NetBeans IDE (recommended β€” the project is a native NetBeans project)

Verify your installation:

java -version
# java version "18.0.x" ...

ant -version
# Apache Ant(TM) version 1.9.x ...

βš™οΈ Installation & Build

Option 1 β€” NetBeans IDE (Recommended)

  1. Clone the repository:
    git clone https://github.com/aymanbismail/Java-2-Project.git
  2. Open Apache NetBeans IDE
  3. Go to File β†’ Open Project and select the Java-2-Project folder
  4. NetBeans detects it as a Java SE project automatically
  5. Click the Build button (or press F11) to compile and package the JAR

Option 2 β€” Apache Ant (Command Line)

git clone https://github.com/aymanbismail/Java-2-Project.git
cd Java-2-Project

# Compile and build the JAR
ant jar

The compiled JAR is output to:

dist/JavaProject.jar

To clean build artifacts:

ant clean

▢️ Running the Application

After building with Ant or NetBeans

java -jar dist/JavaProject.jar

Directly from NetBeans

Press Run (F6) β€” NetBeans compiles and runs the project in the embedded terminal.

From source (javac)

# From the project root
javac -d build/classes src/javaproject/*.java
java -cp build/classes javaproject.JavaProject

πŸ“‹ Usage

Once the application starts, you are presented with a numbered main menu. Enter the corresponding number and follow the prompts.

Option Operation Description
1 Add Item Add a new item (Book / Shoe / Game) to the store inventory
2 Add Customer Register a new customer with a unique ID
3 Add to Cart Add a store item to a specific customer's shopping cart
4 Remove from Cart Remove an item from a customer's shopping cart
5 View Cart Display all items in a customer's cart with a total
6 Checkout Complete the purchase β€” deducts stock and clears the cart
7 Empty Cart Remove all items from a customer's cart and delete the customer
8 Modify Customer Update a customer's ID or name
9 Exit Exit the program

Built-in Help

Enter any option number twice to print a full description of what that operation does:

Input Shows description for
11 Add Item
22 Add Customer
33 Add to Cart
44 Remove from Cart
55 View Cart
66 Checkout
77 Empty Cart
88 Modify Customer

Item Types

When adding an item, you will be asked to select a type:

Key Type Extra Fields
B Book Title, Author
S Shoes β€”
G Game β€”

πŸ—Ί Roadmap

  • File persistence β€” save and load inventory and customer data between sessions (CSV or JSON)
  • Search functionality β€” search items by name or number before adding to cart
  • Discount / coupon system β€” apply percentage or fixed discounts at checkout
  • Multiple item types β€” extend beyond books, shoes, and games (e.g., electronics, clothing)
  • Receipt generation β€” print a formatted receipt to a text file on checkout
  • JUnit test suite β€” unit tests for all core operations
  • Quantity update β€” option to restock item quantities in the store
  • Customer purchase history β€” track past checkouts per customer within a session

🀝 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository on GitHub
  2. Create a branch for your feature or fix:
    git checkout -b feature/your-feature-name
  3. Commit your changes with a clear message:
    git commit -m "Add: description of what you added"
  4. Push to your fork:
    git push origin feature/your-feature-name
  5. Open a Pull Request against the master branch

Guidelines

  • Keep changes focused β€” one feature or fix per PR
  • Do not break existing menu behavior
  • Follow the existing code style (Java naming conventions, ANSI color constants)
  • Test your changes manually by running the full application before submitting

πŸ‘€ Author

Ayman Ismail

GitHub Portfolio LinkedIn


πŸ“„ License

This project was created as an academic assignment. It is shared publicly for educational and portfolio purposes. No license is currently attached β€” please contact the author before reusing or redistributing this code.


πŸ™ Acknowledgements

About

University Project

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages