Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Second class Shocks() is taking parameters from original Rallycars()
- Rallycars determines the minimum permissible weight according to regulations for every category.
- According to the data contained in Rallyclass, Shocks() will let the team know which suspension system should be installed for each kind of car.
- # -*- coding: iso-8859-15 -*-
- class Rallycar(object):
- "Different categories inside Rally regulations"
- def __init__(self, make, model, type):
- self.make = make
- self.model = model
- self.type = type
- def minimumweight(self):
- if self.type.upper() == 'R1':
- minimum = 980
- elif self.type.upper() == 'R2':
- minimum = 1050
- elif self.type.upper() == 'R3':
- minimum = 1150
- elif self.type.upper() == 'R4':
- minimum = 1200
- elif self.type.upper() == 'R5':
- minimum = 1280
- else:
- print "invalid class"
- exit()
- return minimum
- class Shocks(object):
- "Each different car class uses different suspension systems"
- def __init__(self, type, make, model):
- self.type = type
- self.model = model
- self.make = make
- def shocktype(self):
- if self.type.upper() == 'R1':
- print '%s %s must equip Bilstein monotube'% (self.make, self.model)
- elif self.type.upper() == 'R2':
- print '%s %s must equip Ohlins two way'% (self.make, self.model)
- elif self.type.upper() == 'R3':
- print '%s %s must equip Teknoshock three way'% (self.make, self.model)
- elif self.type.upper() == 'R4' or 'R5':
- print '%s %s must equip Ohlins 4 way'% (self.make, self.model)
- marca = raw_input('marca ')
- modelo = raw_input('modelo ')
- tipo = raw_input('tipo ')
- a = Rallycar(marca, modelo, tipo)
- b = Shocks(a.type, a.make, a.model)
- b.shocktype()
- print 'The minimum legal weight will be %d'%(a.minimumweight())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement