# ashutoshkumar2103/calculator architecture

> Architecture diagram of the GitHub repository ashutoshkumar2103/calculator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashutoshkumar2103/calculator
- Repository: https://github.com/ashutoshkumar2103/calculator

## Overview

This is a small Java console calculator. The main loop presents a menu, reads the user’s choice and operands, dispatches valid operations to arithmetic methods, and prints results before repeating or exiting. Division rejects a zero divisor. The menu, input handling, control flow, and arithmetic are all implemented in the single source file; the README documents the same workflow.

Main entry points: [`calculate/calculator.java`](https://github.com/ashutoshkumar2103/calculator/blob/main/calculate/calculator.java) (Calculator loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_calculator["Calculator loop<br/>[calculator.java]"]
node_arithmetic["Arithmetic methods<br/>[calculator.java]"]
node_terminal["Terminal"]

node_calculator -->|"prints menu and results"| node_terminal
node_terminal -->|"shows prompts and output"| node_user
node_user -->|"enters choices and numbers"| node_terminal
node_terminal -->|"provides console input"| node_calculator
node_calculator -->|"dispatches operation"| node_arithmetic
node_arithmetic -->|"returns result"| node_calculator

click node_calculator "https://github.com/ashutoshkumar2103/calculator/blob/main/calculate/calculator.java"
click node_arithmetic "https://github.com/ashutoshkumar2103/calculator/blob/main/calculate/calculator.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_user toneBlue
class node_calculator,node_arithmetic toneTeal
class node_terminal toneIndigo
```

## Components

### Other components

- **User**
- [Calculator loop](https://github.com/ashutoshkumar2103/calculator/blob/main/calculate/calculator.java): `calculate/calculator.java`
- [Arithmetic methods](https://github.com/ashutoshkumar2103/calculator/blob/main/calculate/calculator.java): `calculate/calculator.java`
- **Terminal**

## Connections

- Calculator loop → Terminal: prints menu and results
- Terminal → User: shows prompts and output
- User → Terminal: enters choices and numbers
- Terminal → Calculator loop: provides console input
- Calculator loop → Arithmetic methods: dispatches operation
- Arithmetic methods → Calculator loop: returns result
