I might have a problem with the call on this exercice. Everything is written but I get this errors ( screenshot will be attached). Please provide the answer trough Python screenshot so I have a better visual of the placement and the logic behind it .
Those are the instructions :
Open the file named Motorcycle.py.
1. Create the Motorcycle class by deriving it from the Vehicle class. Use a public derivation.
2. In the Motorcycle class, create an attribute named sidecar.
3. Write a public set method to set the value for sidecar.
4. Write a public get method to retrieve the value of sidecar.
5. Write a public accelerate method. This method overrides the accelerate method inherited from the Vehicle class. Change the message in the accelerate method so the following is displayed when the Motorcycle tries to accelerate beyond its maximum speed: "This motorcycle cannot go that fast".
6. Open the file named MyMotorcycleClassProgram.py.
7. In the MyMotorcycleClassProgram, there are two Motorcycle objects named motorcycleOne and motorcycleTwo.
8. Set the sidecar value of motorcycleOne to true and the sidecar value of motorcycleTwo to false.
9. Set motorcycleOnes maximum speed to 90 and motorcycleTwos maximum speed to 85.
10. Set motorcycleOnes current speed to 65 and motorcycleTwos current speed to 60.
11. Accelerate motorcycleOne by 30 mph, and accelerate motorcycleTwoby 20 mph.
12. Print the current speed of motorcycleOne and motorcycleTwo.
13. Determine if motorcycleOne and motorcycleTwo have sidecars. If yes, display the following: "This motorcycle has a sidecar". If not, display the following: "This motorcycle does not have a sidecar".
14. Execute the program.
?
Traceback (nost recent call last) Motorcycle.py MyMotorcycleclassprog... vehicle.py Summary File "MyMotorcycleClassProgran.??", line 11, in
1 # This progran uses the programer-defined Motorcycle class motorcycle0ne.accelerate(38.8) AttributeError: 'Motorcycle' object has no In this lab, you create a derived class from a base class, and then use the derived class in a Python program. The program should create two Motorcycle objects, and then set the Motorcycle's speed, accelerate the Motorcycle object, and check its sidecar status. attribute 'accelerate 3# Do NOT edit this file. Write your code in Motorcycle-py, 4# then open this file and click "Run Code" 6 fron Motorcycle import Motorcycle 8 notorcycleOne Motorcycle(9., 65.8, True) 9 notorcycleTwo Motorcycle (85., 60.0, False) 10 11 motorcycleOne.accelerate(30.0) Instructions A Line 11: Motorcycle' object has no attribute 'accelerate'. (click for 1. Open the file named Motorcycle.py 2. Create the Motorcycle class by 12 notorcycleTwo.accelerate(20.8) 13 14 print("The current speed of motorcycleOne is "str(notorcycle0ne.speed)) 15 print(" The current speed of motorcycleTwo is "str(notorcycleTwo.speed)) deriving it from the Vehicle class. Use a public derivation. 3. In the Motorcycle class, create an 4. Write a public set method to set the 5. Write a public get method to retriev 6. Write a public accelerate method. 17 if notorcycleOne.stdecar 18 prtnt( "This motorcycle has a stdecar") 19 else: 2 print( "This motorcycle does not have a sidecar") 21 22 if notorcycleTwo.sidecar 23 prtnt( "This motorcycle has a stdecar") 24 else 25 print( This motorcycle does not have a sidecar") attribute named stdecar value for sidecar the value of sidecar This method overrides the accelerate method inherited from Traceback (nost recent call last) Motorcycle.py MyMotorcycleclassprog... vehicle.py Summary File "MyMotorcycleClassProgran.??", line 11, in 1 # This progran uses the programer-defined Motorcycle class motorcycle0ne.accelerate(38.8) AttributeError: 'Motorcycle' object has no In this lab, you create a derived class from a base class, and then use the derived class in a Python program. The program should create two Motorcycle objects, and then set the Motorcycle's speed, accelerate the Motorcycle object, and check its sidecar status. attribute 'accelerate 3# Do NOT edit this file. Write your code in Motorcycle-py, 4# then open this file and click "Run Code" 6 fron Motorcycle import Motorcycle 8 notorcycleOne Motorcycle(9., 65.8, True) 9 notorcycleTwo Motorcycle (85., 60.0, False) 10 11 motorcycleOne.accelerate(30.0) Instructions A Line 11: Motorcycle' object has no attribute 'accelerate'. (click for 1. Open the file named Motorcycle.py 2. Create the Motorcycle class by 12 notorcycleTwo.accelerate(20.8) 13 14 print("The current speed of motorcycleOne is "str(notorcycle0ne.speed)) 15 print(" The current speed of motorcycleTwo is "str(notorcycleTwo.speed)) deriving it from the Vehicle class. Use a public derivation. 3. In the Motorcycle class, create an 4. Write a public set method to set the 5. Write a public get method to retriev 6. Write a public accelerate method. 17 if notorcycleOne.stdecar 18 prtnt( "This motorcycle has a stdecar") 19 else: 2 print( "This motorcycle does not have a sidecar") 21 22 if notorcycleTwo.sidecar 23 prtnt( "This motorcycle has a stdecar") 24 else 25 print( This motorcycle does not have a sidecar") attribute named stdecar value for sidecar the value of sidecar This method overrides the accelerate method inherited from