🛠️ Utilities Implemented
clearScreen()
- Clears the console screen by printing ANSI escape codes.
- Ensures a clean display for the user interface.
- Usage: Called before rendering new content to refresh the console.
printBox(String[] lines)
- Prints a box around a list of strings.
- Dynamically adjusts the width of the box based on the longest string.
- Usage: Used to display menus, messages, or structured data in a visually appealing format.
printLine(int w)
- A helper method for
printBox
.
- Prints a horizontal line of dashes (-) with a width based on the input parameter.
- Usage: Used internally by
printBox
to draw the top and bottom borders of the box.
printGraph(double spent, double total)
- Displays a simple bar graph to represent the proportion of "spent" vs. "remaining" budget.
- Uses a fixed maximum bar length (
maxBar = 30
) and calculates the length of the "spent" bar based on the ratio of spent to total.