"""
Program: Running Total Calculator
Author: ChatGPT (GPT-5.3), generated for user customization
Date: 2026-05-02

Description:
    This program interactively collects numeric input from the user and computes
    a running total. The user is prompted to enter numbers one at a time, and the
    current total is displayed directly in the input prompt for immediate feedback.

    The program continues until the user enters the sentinel value 'STOP'
    (case-insensitive). Invalid inputs are handled gracefully.

Features:
    - Displays purpose-driven instructions to the user
    - Maintains and displays a running total inline with input
    - Accepts floating-point numbers
    - Ignores leading/trailing whitespace in user input
    - Handles invalid input using exception handling

Usage:
    Run the program and follow the on-screen prompts. Enter numeric values or
    type 'STOP' to finish and display the final total.
"""

def main():
    print("This program calculates the sum of the numbers you enter.")
    print("Enter numbers one at a time. Type 'STOP' when you are finished.\n")

    total = 0.0

    while True:
        prompt = f"Enter a number (current total = {total}): "
        user_input = input(prompt)

        if user_input.strip().lower() == "stop":
            break

        try:
            number = float(user_input)
            total += number
        except ValueError:
            print("Invalid input. Please enter a number or STOP.")

    print(f"\nFinal total: {total}")


if __name__ == "__main__":
    main()