# car.py

class Car:

    def __init__(self, dist, type, color):
        # factory method (constructor)
        self.dist = dist
        self.type = type
        self.color = color

    def __str__(self):
        # returns a string version of the object
        return "(" + str(self.dist) + ", " + self.type + ", " + self.color + ")"

    def drive(self, miles):
        if miles < 0:
            print("Drive distance cannot be negative")
        else:
            self.dist += miles

    def setType(self, type):
        if type in ["ferrari", "porsche", "bean", "toyota"]:
          self.type = type
        else:
            print(type, "not supported")

    def setColor(self, color):
         self.color = color

    def getColor(self):
         return self.color.upper()



# test code
car1 = Car(2, "ferrari", "red")
car2 = Car(5, "porsche", "green")
car3 = Car(10000, "bean", "yellow")

car1.drive(100)
print("Car1:", car1)
print("Car1's type:", car1.type)
print("1. Car1's color:", car1.getColor())
print("2. Car1's color:", car1.color)

print()

car3.setColor("blue")
# car3.drive(-9999)
car3.dist = -1
print("Car3: ", car3)



