Final Answer:
Below is a Python program that determines the cost of an armoire based on user input for dimensions and customization options, handling input validation and calculating additional charges as required:
def get_measurements(length, width, height):
length = int(input("Enter the length of the Armoire (in inches): "))
width = int(input("Enter the width of the Armoire (the depth) in inches: "))
height = int(input("Enter the height of the Armoire (in inches): "))
def calc_Large_Volume(length, width, height):
volume = length * width * height
return 100 if volume > 25000 else 0
def calc_Charge(base_price, volume_charge, premium_charge):
custom_lining_charge = 100 if input("Do you want custom lining (Teak wood)? (yes/no): ").lower() == 'yes' else 0
return base_price + volume_charge + premium_charge + custom_lining_charge
base_price = 450
length, width, height = 0, 0, 0
get_measurements(length, width, height)
volume_charge = calc_Large_Volume(length, width, height)
premium_charge = 300 if input("Do you want a premium armoire made of Oak? (yes/no): ").lower() == 'yes' else 0
total_charge = calc_Charge(base_price, volume_charge, premium_charge)
print(f"Armoire Type: {'Premium' if premium_charge > 0 else 'Basic'}")
print(f"Options: {'Oak Premium' if premium_charge > 0 else 'None'}, {'Teak Lining' if total_charge > base_price else 'None'}")
print(f"Cost: ${total_charge}")
Step-by-step explanation:
The program defines functions for getting measurements, calculating volume charges, and determining overall armoire charges. The get_measurements function ensures input validation by restricting dimensions between 18 and 60 inches. The calc_Large_Volume function calculates a volume charge based on the cubic volume of the armoire. The calc_Charge function handles premium armoire charges, including an optional custom lining charge. The main program prompts the user for input, calculates charges, and displays the armoire type, chosen options, and total cost, considering all customization choices and volume charges as required.
This program uses a modular approach, ensuring readability and ease of maintenance. The functions are designed to handle specific tasks, promoting code organization and reusability. The conditional checks within the functions ensure that the program adapts to user choices, offering a customized experience while validating input and preventing unrealistic dimensions. The final output provides a clear summary of the armoire type, selected options, and associated costs, facilitating user understanding and decision-making.