# 8์ฅ Lab ๋์ ๋ฌธ์ ํ์ด
371p_Lab ๋์ ๋ฌธ์ )
class Car:
def __init__(self, speed=0, gear=1, fuel=0, distance=0, color="white"):
self.__speed = speed
self.__gear = gear
self.__color = color
self.__fuel = fuel
self.__distance = distance
def setSpeed(self, speed):
self.__speed = speed
def setGear(self, gear):
self.__gear = gear
def setColor(self, color):
self.__color = color
def Fuel_efficiency(self, fuel):
self.__fuel = fuel
def set_distance(self, distance):
self.__distance = distance
def __str__(self):
return '(์๋: %d, ๊ธฐ์ด: %d, ์ฐ๋น: %d, ์์: %s)\n%dkm ์ฃผํ ์ ํ์ ์ฐ๋ฃ: %dL' \
% (self.__speed, self.__gear, self.__fuel, self.__color, self.__distance, (self.__distance / self.__fuel))
myCar = Car()
myCar.setGear(3)
myCar.setSpeed(100)
myCar.Fuel_efficiency(100)
myCar.set_distance(int(input('์ฃผํ ๊ฑฐ๋ฆฌ: ')))
print('์๋์ฐจ ์ ๋ณด:', myCar)