#!/usr/bin/python3
import sys

# Program: rectangle-area06.py
# Objective: Calculate the area of a rectangle. Check for numeric error on length.
# Revisions
#           Specify the type of the error as ValueError and print the error type.
#           Added same to width.
#           Moved input code to function
# Edward Bigos

def getFloatValue(message):
    try:
        fValue = float(input(message + ": "))
    except ValueError as error:
        print("Error: ",error)
        print("You have entered an invalid value. The input must be a number.")
        sys.exit(-1)
    return fValue

length = getFloatValue("Enter a value for length")
width  = getFloatValue("Enter a value for width ")

area = length * width

print(f"The area of the rectangle is {area:.1f}")
