i have to use the move method for the ship to move. the distance value is less than or equal to the objects fuel attribute.messgae should be displayed reporting the distance the ship moved and the objects fuel attribute should be reduced by the distance value. if not not enough fuel a message should say that it dont have enough fuel
refuel parameter to recieve the amount of fuel to add, if the amount great than or equal to 1 then should add fuel , and a message saying fuel has been added if less than one message should say ship cant be refueled.
in any case the last thing the method should do is call the object.
here what i got
class Ship(object):
"""A spaceship"""
total = 0
def __init__(self, name, fuel=0):
print "My spaceship has arrived! The",name
self.name = name
self.fuel = fuel
print "My fuel level is", fuel
def move(self, fuel=1):
print "ready to move."
self.fuel = move
if self.fuel <1:
self.fuel = 1
self._pass_time()
def status():
Ship.total += 1
print "The total number of objects is", Ship.total
status = staticmethod(status)
ship = Ship("enterprise")
print "\nCreating objects."
ship1 = Ship("object 1")
ship2 = Ship("object 2")
ship3 = Ship("object 3")
Ship.status()
print "\nship 1's fuel level is ", ship1.fuel