Suppose you are an owner of a car wash & service center. Now, implement the design of the Car class so that the following output is produced: [Your code should work for any number of services added in the add_Services method]
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
????????:
Suppose you are an owner of a car wash & service center. Now, implement the design of the Car class so that the following output is produced:
[Your code should work for any number of services added in the add_Services method]
# Write your code here
print(“No.of Car=”, Car.count)
c1 = Car('Lamborghini', 2002)
c1.add_Services('Battery Replacement', 'A/C Recharge')
c2 = Car('Toyota Corolla', 2016)
c2.add_Services('Radiator Flush', 'Fill Service')
c3 = Car('Mitsubishi Pajero', 2018)
c3.add_Services('Filter change', 'Timing Belt Replacement')
print("=========================")
c1.printCarDetail()
print("=========================")
c2.printCarDetail()
print("=========================")
c3.printCarDetail()
print("=========================")
print(“No.of Car =”, Car.count)
Output:
No.of Car = 0
=========================
Name: Lamborghini
Year of manufacture: 2002
List of Services: Battery Replacement , A/C Recharge
=========================
Name: Toyota Corolla
Year of manufacture: 2016
List of Services: Radiator Flush , Fill Service
=========================
Name: Mitsubishi Pajero
Year of manufacture: 2018
List of Services: Filter change , Timing Belt Replacement
=========================
No.of Car = 3
Step by step
Solved in 4 steps with 3 images