Skip to content

Muaadh-Nazly/one-net-cafe-gui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Internet Café Inventory Management System

📋 Project Overview

A comprehensive JavaFX-based GUI application for managing inventory at an Internet Café. The system provides a complete solution for item management, dealer selection, and data persistence using object-oriented programming principles. Built with Java 18 and JavaFX, featuring a modern user interface with robust validation and testing.

✨ Key Features

Core Functionality

  • Add Item Details - Add items with validation (Code, Name, Brand, Price, Quantity, Category, Date, Image)
  • Delete Item Details - User-friendly item deletion mechanism
  • Update Item Details - Modify existing item information
  • View Items - Display items sorted by category with thumbnails and total cost calculation
  • Save to File - Persistent storage using serialization (.ser files)
  • Random Dealer Selection - Select 4 dealers randomly from a text file
  • Dealer Management - Display selected dealers sorted by location (custom sorting algorithm)
  • Dealer Items Display - Show items associated with selected dealers
  • Resume Capability - Load previously saved data on application startup

Technical Highlights

  • Custom Sorting Algorithm - Implemented without using Java's built-in sorting methods
  • Input Validation - Comprehensive validation for all user inputs
  • Exception Handling - Robust error handling throughout the application
  • JUnit Testing - Complete test suite covering validation and functionality
  • OOP Principles - Encapsulation, Inheritance, and proper class design

🛠️ Technology Stack

  • Language: Java 18
  • Framework: JavaFX 18.0.2
  • Build Tool: Maven
  • Testing: JUnit 5.9.2
  • UI Design: FXML with CSS styling
  • Data Persistence: Java Serialization

📁 Project Structure

├── src/
│   ├── main/
│   │   ├── java/
│   │   │   ├── com/example/cw_test_1601/
│   │   │   │   ├── Application.java          # Main entry point
│   │   │   │   ├── Controller.java           # Main controller for navigation
│   │   │   │   ├── Items.java                # Item entity class
│   │   │   │   ├── Dealer.java               # Dealer entity class
│   │   │   │   ├── Storage.java              # Data storage utilities
│   │   │   │   ├── AID.java                  # Add Item Details controller
│   │   │   │   ├── DID.java                  # Delete Item Details controller
│   │   │   │   ├── UID.java, UID2.java      # Update Item Details controllers
│   │   │   │   ├── VID.java                  # View Items controller
│   │   │   │   ├── SDD.java                  # Select Dealer Details controller
│   │   │   │   ├── VRL.java                  # View Random Dealers controller
│   │   │   │   ├── LDI1.java, LDI2.java      # Load Dealer Items controllers
│   │   │   │   ├── Available.java            # Available items controller
│   │   │   │   ├── AvailableItems.java       # Available items model
│   │   │   │   ├── DealerItems.java          # Dealer items model
│   │   │   │   ├── ImageThumbnail.java       # Image handling utilities
│   │   │   │   └── [Other utility classes]
│   │   │   └── module-info.java
│   │   └── resources/
│   │       └── com/example/cw_test_1601/
│   │           ├── *.fxml                    # FXML UI layouts
│   │           ├── Application.css            # Stylesheet
│   │           └── Icons/                     # Application icons
│   └── Test/
│       └── com/example/cw_test_1601/
│           ├── InputsTest.java                # Input validation tests
│           └── LoginTest.java                 # Login functionality tests
├── Test/                                      # Test validators and utilities
├── Images/                                    # Sample item images
├── data/                                      # Data files (dealers, serialized data)
├── pom.xml                                    # Maven configuration
└── README.md                                  # This file

🚀 Getting Started

Prerequisites

  • Java Development Kit (JDK) 18 or higher
  • Maven 3.6+ (or use included Maven Wrapper)
  • IDE with JavaFX support (IntelliJ IDEA, Eclipse, VS Code)

Installation & Setup

  1. Clone the repository

    git clone <repository-url>
    cd <repository-name>
  2. Build the project

    mvn clean compile

    Or using Maven Wrapper:

    ./mvnw clean compile
  3. Run the application

    mvn javafx:run

    Or using Maven Wrapper:

    ./mvnw javafx:run

Default Login Credentials

  • Username: The Boss
  • Password: TheBoss1970

🧪 Testing

Run the JUnit test suite:

mvn test

The test suite includes:

  • Input validation tests (Item Code, Name, Brand, Price, Quantity, Category, Date, Image)
  • Login functionality tests
  • Edge case handling

📊 Application Workflow

  1. Login → Authenticate with credentials
  2. Home Screen → Access main menu with all features
  3. Item Management → Add, Update, Delete, View items
  4. Dealer Selection → Randomly select 4 dealers
  5. Dealer View → View selected dealers sorted by location
  6. Dealer Items → Display items for selected dealers
  7. Data Persistence → Save/load data automatically

🏗️ Architecture & Design Patterns

Object-Oriented Design

  • Encapsulation: All entity classes (Items, Dealer) use private fields with getters
  • Inheritance: Controller classes extend base Storage class
  • Separation of Concerns: Clear separation between UI (FXML), Controllers, and Models

Key Classes

Items.java

  • Represents an inventory item with all required attributes
  • Immutable design with final fields
  • Includes total cost calculation

Dealer.java

  • Represents a dealer with name, telephone, and location
  • Used for random selection and sorting

Storage.java

  • Base class for data persistence operations
  • Handles serialization/deserialization
  • Manages file I/O operations

📝 Data Files

Dealer Files Format

Each dealer file ([Name].txt) contains:

[Name], [Telephone], [Location]
[Item Name], [Brand], [Price], [Quantity]
...

Serialized Data

  • Saved Details.ser - Contains all item data in serialized format
  • Automatically loaded on application startup
  • Updated when items are added, modified, or deleted

🎨 UI Features

  • Modern JavaFX Interface - Clean and intuitive design
  • Form Validation - Real-time input validation with error messages
  • Image Support - Thumbnail display for items
  • Responsive Layout - Fixed-size windows optimized for functionality
  • Icon Integration - Custom icons for better UX

🔒 Validation Rules

The application implements strict validation:

  • Item Code: 3-digit numeric format (e.g., "001")
  • Item Name: Max 20 characters, alphanumeric
  • Brand: Max 20 characters, alphanumeric
  • Price: Positive decimal number
  • Quantity: Positive integer
  • Category: Max 20 characters
  • Date: Valid date format, not in future
  • Image: Valid image file path (.jpg, .jpeg, .png)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors