# kushal-sw/billing-system-java architecture

> Architecture diagram of the GitHub repository kushal-sw/billing-system-java, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kushal-sw/billing-system-java
- Repository: https://github.com/kushal-sw/billing-system-java

## Overview

This is a small, console-based supermarket billing program. A customer enters a name, selects catalogue products and quantities, and can add multiple items; the program then calculates subtotal, tiered discount, GST, and prints a tax invoice. The runtime is a single Java class with in-memory catalogue and cart arrays. The README gives no further capability details, so the diagram reflects the sampled source only.

Main entry points: [`SupermarketBilling.java`](https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java) (Shopping orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shopping["Shopping flow"]
  node_main["Shopping orchestration"]
  node_catalogue[("Product catalogue")]
  node_cart[("In-memory cart")]
end

subgraph group_billing["Billing"]
  node_subtotal["Subtotal calculation"]
  node_discount["Discount calculation"]
  node_invoice["Invoice generation"]
end

node_customer(("Customer"))
node_console["Console input/output"]

node_customer -->|"provides selections"| node_main
node_main -->|"prompts and prints"| node_console
node_main -->|"displays products"| node_catalogue
node_main -->|"adds selections"| node_cart
node_main -->|"generates invoice"| node_invoice
node_invoice -->|"calculates subtotal"| node_subtotal
node_invoice -->|"calculates discount"| node_discount
node_subtotal -->|"reads quantities"| node_cart
node_invoice -->|"reads prices and GST"| node_catalogue
node_invoice -->|"prints tax invoice"| node_console

click node_main "https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java"
click node_catalogue "https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java"
click node_cart "https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java"
click node_subtotal "https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java"
click node_discount "https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java"
click node_invoice "https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_catalogue,node_cart toneBlue
class node_subtotal,node_discount,node_invoice toneAmber
class node_customer,node_console toneIndigo
```

## Components

### Shopping flow

- [Shopping orchestration](https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java): `SupermarketBilling.java`
- [Product catalogue](https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java): `SupermarketBilling.java`
- [In-memory cart](https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java): `SupermarketBilling.java`

### Billing

- [Subtotal calculation](https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java): `SupermarketBilling.java`
- [Discount calculation](https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java): `SupermarketBilling.java`
- [Invoice generation](https://github.com/kushal-sw/billing-system-java/blob/main/SupermarketBilling.java): `SupermarketBilling.java`

### Other components

- **Customer**
- **Console input/output**

## Connections

- Customer → Shopping orchestration: provides selections (evidence: `SupermarketBilling.java`)
- Shopping orchestration → Console input/output: prompts and prints (evidence: `SupermarketBilling.java`)
- Shopping orchestration → Product catalogue: displays products (evidence: `SupermarketBilling.java`)
- Shopping orchestration → In-memory cart: adds selections (evidence: `SupermarketBilling.java`)
- Shopping orchestration → Invoice generation: generates invoice (evidence: `SupermarketBilling.java`)
- Invoice generation → Subtotal calculation: calculates subtotal (evidence: `SupermarketBilling.java`)
- Invoice generation → Discount calculation: calculates discount (evidence: `SupermarketBilling.java`)
- Subtotal calculation → In-memory cart: reads quantities (evidence: `SupermarketBilling.java`)
- Invoice generation → Product catalogue: reads prices and GST (evidence: `SupermarketBilling.java`)
- Invoice generation → Console input/output: prints tax invoice (evidence: `SupermarketBilling.java`)
