# (DD02) Business Logic — ConsoleUI.printMenu() [13 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `ui.ConsoleUI` |
| Layer | UI / Presentation |
| Module | `ui` (Package: `ui`) |

## 1. Role

### ConsoleUI.printMenu()

This method is the presentation-layer menu renderer for the console application. Its business role is to present the available end-user operations in a fixed, numbered list so the user can choose the next action in the workflow. The menu covers the core library-style operations supported by the application: adding books, listing books, searching books, registering members, listing members, borrowing books, returning books, listing active loans, and exiting the program. It does not perform any business validation, persistence, or domain mutation; instead, it acts as a simple routing aid that frames the next interaction step for the user. The implementation follows a direct output/display pattern and serves as a reusable screen helper called from the main console flow before user input is collected.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
START(["printMenu()"])
MENU(["Display menu text to the console"])
END_NODE(["Return / Next"])
START --> MENU
MENU --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | - |

This method takes no parameters. It relies only on the internal console output stream and the class's presentation flow. No instance fields are read or updated by this method.

## 4. CRUD Operations / Called Services

This method does not invoke any CRUD service, repository, DAO, or domain mutation method. Its only operation is console output via `System.out.println`, which is a presentation action rather than a business CRUD operation.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|-----------------------|
| - | - | - | - | No service calls; renders the menu text only |

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: -

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `ConsoleUI` (same class) | `ConsoleUI.mainFlow` -> `printMenu` | `-` |

## 6. Per-Branch Detail Blocks

**Block 1** — [SINGLE STEP] (L42)

> Displays the static main menu text to guide the user to the next console action.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `System.out.println("""...""");` // prints the menu options to the console |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ConsoleUI` | Class | Console user interface that presents application menus and collects user choices |
| `printMenu` | Method | Displays the main action menu for the user |
| `System.out.println` | Technical API | Java standard output call used to write text to the console |
| `Add book` | Menu option | Starts the workflow to register a new book |
| `List all books` | Menu option | Shows all books currently available in the catalog |
| `Search books` | Menu option | Opens the book search workflow |
| `Register member` | Menu option | Starts the workflow to add a new member |
| `List members` | Menu option | Shows the member list |
| `Borrow book` | Menu option | Starts the loan creation workflow for an available book |
| `Return book` | Menu option | Starts the loan return workflow |
| `List active loans` | Menu option | Shows loans that are currently active |
| `Exit` | Menu option | Ends the console session |
