This project is a Retail Store Billing System developed in Java, created as part of an on-site coding assessment during a job interview. It was completed within one day and successfully led to a job offer. The solution demonstrates strong object-oriented design, clean code principles, and the ability to translate business rules into code efficiently under time pressure.
The task was to build a billing system that calculates the net payable amount for a customer after applying:
- User-based percentage discounts
- Flat discounts per $100 on the bill
- Category-based exclusions (e.g., no discount on groceries)
-
Percentage-based discounts:
- Employees get a 30% discount.
- Affiliates get a 10% discount.
- Customers who’ve been with the store for over 2 years get a 5% discount.
- Groceries are excluded from percentage-based discounts.
-
Flat discount:
- For every $100 on the total bill (after applying the percentage discount), a flat $5 discount is applied.
- Clean object-oriented architecture using Java
- Polymorphism and inheritance for user roles (
Employee,Affiliate,Customer) - Enum usage for product categorization
- Unit tests with JUnit to validate business rules
- Introduced a
ShoppingCartabstraction to manage cart entries and decouple billing logic from item management - Simple logging utility and date calculation helper
- Clear separation of responsibilities across classes
Includes multiple unit tests using JUnit, covering scenarios such as:
- Discounts on groceries vs. non-groceries
- Combined percentage and flat discounts
- Behavior for different user roles and durations
src/
├── com.company.retailstore
│ ├── Bill.java
│ ├── BillTest.java
│ ├── Customer.java
│ ├── Employee.java
│ ├── Affiliate.java
│ ├── ShoppingCart.java
│ ├── ShoppingCartEntry.java
│ ├── Product.java
│ ├── ProductType.java
│ ├── User.java
│ └── util/
│ ├── DateUtil.java
│ └── Log.java
- Java
- JUnit 4
This repository highlights my ability to:
- Quickly understand business requirements and turn them into working code
- Apply OOP concepts to build a maintainable and extensible system
- Write logic that is easy to verify and test under real-world constraints
Although the original problem did not require a shopping cart system, I chose to introduce a ShoppingCart abstraction. This decision allowed for:
- A cleaner separation between billing and cart logic
- Better extensibility for future features like item removal or cart summaries
- A more realistic domain model that mirrors common retail systems
This project was developed as part of an on-site coding assessment during a multi-stage interview process. The hiring journey included:
- An initial HR interview
- A technical interview at the company
- An on-site coding assessment (this project)
- A follow-up take-home coding assignment
I successfully completed all steps and received a job offer based on my performance across both coding assessments and interviews.
This code is released under the MIT License.