Question: Object.php Create a PHP script that will perform the following tasks. Define a class Vehicle which has protected properties: make, model, year, price. Create a

Object.php

Create a PHP script that will perform the following tasks.

Define a class Vehicle which has protected properties: make, model, year, price. Create a constructor method that takes in make, model, year, and price. Implement a public method displayObject() to display the properties of each object instance.

Define a derived class LandVehicle that inherits from the Vehicle class and contains a private property: maxSpeed. You may need to override the constructor and displayObject() method for this derived class.

Define another derived class WaterVehicle that also inherits from the Vehicle class and contains private property: boatCapacity. You may need to override the constructor and displayObject() method for this derived class.

Instantiate (Create) at least three objects of LandVehicle and display the properties of each object instance. Sample output is as follows:

Make:Toyota,

Model:Camry,

Year:1992,

Price:2000,

Speed Limit:180

Make:Honda,

Model:Accord,

Year:2002,

Price:6000,

Speed Limit:200

Instantiate (Create) at least three objects of WaterVehicle and display the properties of each object instance. Sample output is as follows:

Make:Mitsubishi,

Model:Turbo,

Year:1999,

Price:20000,

Boat Capacity:18

Make:Hyundai,

Model:XT,

Year:2012,

Price:26000,

Boat Capacity:8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!