class Car:
def __init__(self, brand, model, color, engine, price):
self.brand = brand
self.model = model
self.color = color
self.engine = engine
self.price = price
def display_info(self):
print("Brand:", self.brand)
print("Model:", self.model)
print("Color:", self.color)
print("Engine:", self.engine)
print("Price:", self.price)
def main():
cars = {
"M": Car("Mercedes", "S-Class", "Black", "V8", "$100,000"),
"T": Car("Toyota", "Corolla", "White", "Inline-4", "$20,000"),
"F": Car("Ford", "Mustang", "Red", "V6", "$30,000"),
"R": Car("Range Rover", "Evoque", "Blue", "V6", "$50,000")
user_input = input("Enter a letter (M for Mercedes, T for Toyota, F for Ford, R for Range Rover):
").upper()
if user_input in cars:
car = cars[user_input]
print("\nCar Information:")
car.display_info()
else:
print("Invalid input. Please try again.")
if __name__ == "__main__":
main()