示例#1
0
文件: main.py 项目: MCreese2/com404
from Bot import Bot
from SuperBot import SuperBot
from FlyingBot import FlyingBot

#Creates an object "walle" with parameters of the bot class
walle = Bot("Wall-E", 15, 25, 20)

superwalle = SuperBot("Super Walle-E", 20, 30, 25, 15)

flyingsuperwalle = FlyingBot("Flying Super Walle-E", 25, 35, 30, 20, 5)

#Invoked the methods on the bot class
walle.display_name()
walle.display_age()
walle.display_energy()
walle.display_shield()

superwalle.display_name()
superwalle.display_age()
superwalle.display_energy()
superwalle.display_shield()
#invokes the superbot method
superwalle.display_super_power_level()

flyingsuperwalle.display_name()
flyingsuperwalle.display_age()
flyingsuperwalle.display_energy()
flyingsuperwalle.display_shield()
flyingsuperwalle.display_super_power_level()
#invokes the flying bot method
flyingsuperwalle.display_hover()
示例#2
0
print("Please enter the bot's name")
bots_name = input()
print("Please enter the bot's age")
bots_age = int(input())
print("Please enter the bot's energy level")
bots_energy_level = int(input())
print("Please enter the bots shield level")
bots_shield_level = int(input())

New_Bot = Bot(bots_name, bots_age, bots_energy_level, bots_shield_level)
New_Super_Bot = SuperBot()
New_Flying_Bot = FlyingBot()

#Displaying methods
New_Bot.display_name()
New_Bot.display_age()
New_Bot.dispaly_energy()
New_Bot.display_shield()
New_Bot.display_summary()

#Returning methods
New_Bot.get_age()
New_Bot.get_name()
New_Bot.get_energy()
New_Bot.get_shield()
New_Flying_Bot.get_hover_distane()
New_Super_Bot.get_super_power_level()

#Incrementing and Decrementing Methods
New_Bot.decrement_energy(2)
示例#3
0
文件: main.py 项目: JordanDG/com404
from Bot import Bot
from SuperBot import SuperBot
from FlyingBot import FlyingBot

test = Bot("Botty")

test.get_age()
test.get_energy()
test.get_name()
test.get_shield()

test.decrement_energy()
test.decrement_shield()

test.display_name()
test.display_age()
test.display_energy()
test.display_shield_level()
test.display_summary()
print(test.__str__())

test.increment_age()
test.increment_energy()
test.increment_shield()

test.set_name()

super_bot = SuperBot("John")

super_bot.get_super_power_level(3000)
super_bot.set_super_power_level(3000)