Answer to Question #250157 in Python for phil

Question #250157

There are 2 types of tyres in stock, namely those for luxury vehicles and those for construction vehicles.


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:

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.

d) Create a class called Bonuses which contains a constructor and a function called Calc

for calculating the bonus that the client is eligible to recieve. A client may recieve a

bonus if the total price of the tyres he/she has purchased is greater than $500.00.


1
Expert's answer
2021-10-12T01:45:10-0400
class Luxury():
    def __init__(self, size,wheelNumbers):
        self.size = size
        self.wheelNumbers = wheelNumbers


    def Calc(self):
        #Less than 10 Inches 3.50
        if self.size<10:
            return 3.5*self.wheelNumbers
        #10- 15 Inches 4.00
        if self.size>=10 and self.size<15:
            return 4.0*self.wheelNumbers
        #Greater than 15 inches 6.00
        if self.size>=15:
            return 6.0*self.wheelNumbers
luxury =Luxury(10,3)
print(f"Totol price for Luxury = {luxury.Calc()}")


class Bonuses(Luxury):
    def __init__(self, size,wheelNumbers):
        super().__init__(size, wheelNumbers) 


    def Calc(self):
        totalPrice=super().Calc()
        if totalPrice>=500:
            return totalPrice-(totalPrice*0.1)
        return totalPrice
bonuses =Bonuses(20,500)
print(f"Totol price for Bonuses = {bonuses.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