Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 constructorand displayObject() method for this derived class.

Define another derived class WaterVehicle that also inherits from the Vehicleclass and contains private property: boatCapacity. You may need to override theconstructor 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

IMPORTANT: PLEASE MAKE SURE THAT YOU HAD TESTED YOUR CODE BEFORE POSTING.

YOU CAN USE < www.phptester.net > TO RUN YOUR CODE.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

Students also viewed these Databases questions