This is a Console-Based Retail Point of Sale (POS) System developed using Core Java with Text File Storage for data persistence. The project demonstrates comprehensive use of Object-Oriented Programming concepts, File Handling, Exception Handling, and modular design.
This project is designed for a team of 4 members, with each member responsible for specific packages and modules:
- Package:
com.retailpos.main - Files:
MainApp.java - Responsibilities:
- Menu-driven application interface
- User authentication system
- Main program flow control
- Integration of all modules
- Package:
com.retailpos.model - Files:
Product.java,Customer.java,Bill.java - Responsibilities:
- Entity class design
- Encapsulation implementation
- Data modeling
- Inner class implementation (BillItem)
- Package:
com.retailpos.service - Files:
InventoryService.java,BillingService.java - Responsibilities:
- Inventory management logic
- Billing operations
- Customer management
- CRUD operations
- Report generation
- Package:
com.retailpos.util&com.retailpos.exception - Files:
FileUtil.java,ValidationUtil.javaProductNotFoundException.java,InsufficientStockException.java,InvalidInputException.java,AuthenticationException.java
- Responsibilities:
- File I/O operations
- Data validation
- Custom exception classes
- Error handling utilities
com.retailpos
├── main
│ └── MainApp.java (Suraj Arya)
├── model
│ ├── Product.java (Aryan Pandey)
│ ├── Customer.java (Aryan Pandey)
│ └── Bill.java (Aryan Pandey)
├── service
│ ├── InventoryService.java (Vaibhavi Anand)
│ └── BillingService.java (Vaibhavi Anand)
├── util
│ ├── FileUtil.java (Atul Mishra)
│ └── ValidationUtil.java (Atul Mishra)
└── exception
├── ProductNotFoundException.java (Atul Mishra)
├── InsufficientStockException.java (Atul Mishra)
├── InvalidInputException.java (Atul Mishra)
└── AuthenticationException.java (Atul Mishra)
data/
├── products.txt - Product inventory data
├── customers.txt - Customer information
├── bills.txt - Generated bills/invoices
└── users.txt - Login credentials
products.txt:
ProductID|ProductName|Category|Price|StockQuantity|Description
P001|Laptop|Electronics|45000.00|15|Dell Inspiron 15 3000 Series
customers.txt:
CustomerID|CustomerName|PhoneNumber|Email|TotalPurchaseAmount
C001|Rahul Sharma|9876543210|rahul.sharma@email.com|0.0
users.txt:
Username|Password|Role
admin|admin123|ADMIN
cashier|cash123|CASHIER
bills.txt:
BillID|CustomerID|CustomerName|CashierName|BillDate|Subtotal|GST|TotalAmount|Items
B0001|C001|Rahul Sharma|admin|01-01-2026 10:30:00|45000.00|8100.00|53100.00|P001:Laptop:1:45000.00
- Encapsulation: All model classes with private fields and public getters/setters
- Inheritance: Exception classes extending base Exception class
- Polymorphism: Method overloading in constructors and utilities
- Abstraction: Service layer abstracting business logic
- FileReader / FileWriter
- BufferedReader / BufferedWriter
- Try-Catch-Finally blocks
- File existence checking
- Directory creation
- ArrayList for dynamic lists
- HashMap for key-value storage
- Iterating collections
- Custom exception classes
- Try-Catch blocks
- Exception propagation
- Meaningful error messages
- Inner classes (BillItem inside Bill)
- Static methods and constants
- String parsing and tokenization
- Date/Time handling
- Wrapper classes (Integer, Double)
- Input validation
- Login system with username and password
- Role-based access (Admin/Cashier)
- Maximum 3 login attempts
- Credentials stored in users.txt
- Add new products
- View all products
- Search products by ID/Name/Category
- Update product details
- Delete products
- Auto-generated Product IDs
- Check stock availability
- Add stock to products
- Low stock alerts (stock < 10)
- Calculate total inventory value
- Stock reduction after billing
- Create new bills
- Add multiple products to bill
- Calculate subtotal, GST (18%), and total
- Generate and display invoice
- Save bills to file
- Search bills
- Add new customers
- View all customers
- Search customers
- Track purchase history
- Auto-generated Customer IDs
- Sales report (total sales, GST, items sold)
- Inventory report
- Customer report
-
Compile the project:
chmod +x compile.sh ./compile.sh
-
Run the application:
chmod +x run.sh ./run.sh
-
Compile all files:
javac -d bin -sourcepath src src/com/retailpos/exception/*.java javac -d bin -sourcepath src src/com/retailpos/util/*.java javac -d bin -sourcepath src src/com/retailpos/model/*.java javac -d bin -sourcepath src src/com/retailpos/service/*.java javac -d bin -sourcepath src src/com/retailpos/main/*.java
-
Run the application:
cd bin java com.retailpos.main.MainApp
- Import the project into Eclipse/IntelliJ/NetBeans
- Set
srcas source folder - Run
MainApp.java
| Username | Password | Role |
|---|---|---|
| admin | admin123 | ADMIN |
| cashier | cash123 | CASHIER |
| manager | manager123 | MANAGER |
- Login as admin
- Select Product Management → Add New Product
- Enter product details
- Product saved to products.txt
- Login as cashier
- Select Billing System → Create New Bill
- Enter Customer ID
- Add products with quantities
- Confirm billing
- Invoice generated and saved
- Stock automatically reduced
- Select Inventory Management → Low Stock Alert
- View products with stock < 10
- Add stock as needed
- Proper Comments: Every class and method documented
- Developer Attribution: Each file has developer name and responsibility
- Modular Design: Clear separation of concerns
- Error Handling: Comprehensive exception handling
- Input Validation: All user inputs validated
- Clean Code: Proper naming conventions and formatting
- Resource Management: Proper closing of file streams
Students working on this project will learn:
-
Core Java Concepts:
- OOP principles
- File handling with text files
- Exception handling
- Collections framework
-
Software Design:
- Package organization
- Layered architecture
- Separation of concerns
- Modular programming
-
Real-World Skills:
- Team collaboration
- Code documentation
- Error handling strategies
- Data validation
-
Problem Solving:
- Inventory management logic
- Billing calculations
- Search and filter operations
- Report generation
- Ensure
datadirectory exists in project root - Check file paths in FileUtil.java
- Verify Java version (Java 8 or higher)
- Check CLASSPATH settings
- Ensure all files are in correct packages
- Check users.txt file exists
- Verify credentials format in file
- No GUI: This is a console-based application
- No Database: All data stored in text files
- Text Files Only: Uses .txt files for storage
- File Handling: Proper exception handling for file operations
- Data Persistence: Data saved immediately after operations
- GST Calculation: Fixed at 18% for all products
- All Java files with proper package structure
- Developer name mentioned in each file
- Sample data files (products.txt, customers.txt, users.txt)
- Compilation scripts
- README documentation
- Code compiles without errors
- Application runs successfully
- All features working as expected
For issues or questions:
- Check the README carefully
- Review code comments and JavaDoc
- Verify file paths and permissions
- Check Java version compatibility
This project is created for educational purposes as part of a Core Java course assignment.
Developed by Team of 4 Members (Suraj Arya, Aryan Pandey, Vabhavi Anand, Atul Mishra) Technology Stack: Core Java, File Handling, Console I/O Version: 1.0 Date: January 2026