Answer to Question #250531 in Python for phil

Question #250531

The

company wants to use a computerised system for selling their tyres. There are 2 types of

tyres in stock, namely those for luxury vehicles and those for construction vehicles.

4

Construction vehicle tyres cost twice the price of luxury vehicle tyres, and the prices

depend on the wheel size according to the following price list for luxury vehicles:

Wheel Size Price/Unit measurement ($)

Less than 10 Inches 3.50

10- 15 Inches 4.00

Greater than 15 inches 6.00

You are required to create a python program that implements the program according to

the following guidelines:

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.


1
Expert's answer
2021-10-13T03:50:33-0400
class Home:
    def __init__(self, type_of_vehicle, size_of_tyres, number_of_tyres):
        self.type_of_vehicle = type_of_vehicle
        self.size_of_tyres = size_of_tyres
        self.number_of_tyres = number_of_tyres
class Construction:
    def __init__(self, type_of_vehicle, size_of_tyres, number_of_tyres):
        self.type_of_vehicle = type_of_vehicle
        self.size_of_tyres = size_of_tyres
        self.number_of_tyres = number_of_tyres
    def  Calc(self):
        total = 0.0
        if self.size_of_tyres <10:
            total = 3.5 * self.number_of_tyres
        elif self.size_of_tyres >=10 or self.size_of_tyres <= 15:
            total = 4.0 * self.number_of_tyres 
        elif self.size_of_tyres > 15:
            total = 6.0 * self.number_of_tyres
            
            
        print(total)
c = Construction("Construction", 9, 10)
print(c.Calc())

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS