2 types of tyres in stock, namely for luxury vehicles and for construction vehicles.
Cons vehicle tyres cost twice the price of luxury vehicle tyres, the prices
depend on the wheel size according to the following price list for luxury vehicles:
Wheel Size: Price ($)
Less than 10 Inches: 3.50
10- 15 Inches: 4.00
Greater than 15 inches: 6.00
create a python program that implements the program:
a) Create a class called Home, which contains a function called Details for receiving the
values of the type of vehicle, the size of the tyres and the number of tyres for the
vehicle.
b) Create a class called Construction which contains:
i) A constructor
ii) A function called Calc for doing relevant calculations for calculating the total price
of the tyres purchased for construction vehicles.
c) Create a class called Luxury which contains:
i) A constructor
ii) A function called Calc for doing relevant calculations for calculating the total price
of wheels purchased for construction vehicles.
class Home:
def Details( type_of_vehicle, size_of_tyres, number_of_tyres):
pass
class Construction():
def __init__(self, wheelSize):
self.wheelSize=wheelSize
def Calc(self):
price=0
if (self.wheelSize<10):
price=3.50*2
elif (self.wheelSize>=10 and self.wheelSize<=15):
price=4.00*2
elif (self.wheelSize>15):
price=6.00*2
print("Price per tyre is: ",price)
class Luxury():
def __init__(self, wheelSize):
self.wheelSize=wheelSize;
def Calc(self):
price=0
if (self.wheelSize<10):
price=3.50
elif (self.wheelSize>=10 and self.wheelSize<=15):
price=4.00
elif (self.wheelSize>15):
price=6.00
print("Price per tyre is: ",price)
c=Construction(8)
c.Calc()
l=Luxury(15)
l.Calc()
Comments
Leave a comment