Personal Finance Tracker
 
Loading...
Searching...
No Matches
user_entry_manager.UserEntryManager Class Reference

Public Member Functions

 get_date (cls, prompt, allow_default=False)
 
 get_amount (cls)
 
 get_category (cls)
 

Static Public Member Functions

 get_transaction_id ()
 
 get_description ()
 

Static Public Attributes

str DATE_FORMAT = "%m-%d-%Y"
 
dict CATEGORIES
 

Detailed Description

Manages user entry for transactions, including date, amount, category, and description.

Attributes:
    DATE_FORMAT (str): The format used for parsing and displaying dates.
    CATEGORIES (dict): Mapping of input to transaction categories ('I' for Income, 'E' for Expense).

Member Function Documentation

◆ get_amount()

user_entry_manager.UserEntryManager.get_amount ( cls)
Prompts the user to input a valid amount for the transaction.

Returns:
    float: A valid transaction amount entered by the user.

Raises:
    ValueError: If the entered amount is less than or equal to zero.

◆ get_category()

user_entry_manager.UserEntryManager.get_category ( cls)
Prompts the user to input a category ('I' for Income, 'E' for Expense).

Returns:
    str: The corresponding category (Income/Expense) based on the user's input.

Raises:
    ValueError: If an invalid category is entered.

◆ get_date()

user_entry_manager.UserEntryManager.get_date ( cls,
prompt,
allow_default = False )
Prompts the user for a date in the format 'mm-dd-yyyy'. Optionally allows defaulting to today's date.

Args:
    prompt (str): The prompt message for the user.
    allow_default (bool): If True, the user can leave the date blank to default to today's date.

Returns:
    str: A valid date string in 'mm-dd-yyyy' format.

◆ get_description()

user_entry_manager.UserEntryManager.get_description ( )
static
Prompts the user for an optional description of the transaction.

Returns:
    str: The description entered by the user, or an empty string if not provided.

◆ get_transaction_id()

user_entry_manager.UserEntryManager.get_transaction_id ( )
static
Prompts the user to input a transaction ID.

Returns:
    int: The transaction ID entered by the user.

Member Data Documentation

◆ CATEGORIES

dict user_entry_manager.UserEntryManager.CATEGORIES
static
Initial value:
= {
"I": "Income",
"E": "Expense"
}

◆ DATE_FORMAT

user_entry_manager.UserEntryManager.DATE_FORMAT = "%m-%d-%Y"
static

The documentation for this class was generated from the following file: