0% found this document useful (0 votes)
23 views

Convert The Following Code Into PHP

The document provides descriptions for defining two classes in PHP - a Flight class with private data members for flight number, destination, distance, and fuel, and methods to calculate fuel based on distance and display information, and a class inheritance hierarchy with classes PPP, QQQ, and RRR where RRR can set the private member H of class PPP.

Uploaded by

Ansa Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Convert The Following Code Into PHP

The document provides descriptions for defining two classes in PHP - a Flight class with private data members for flight number, destination, distance, and fuel, and methods to calculate fuel based on distance and display information, and a class inheritance hierarchy with classes PPP, QQQ, and RRR where RRR can set the private member H of class PPP.

Uploaded by

Ansa Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Question 1: 

Define a class in php with following description:

Private Members
A data member Flight number
A data member Destination
A data member Distance
A data member Fuel
A member function CALFUEL() to calculate the value of Fuel as per the following criteria
            Distance                                                          Fuel
            <=1000                                                           500
            more than 1000  and <=2000                          1100
            more than 2000                                              2200
Public Members
A function FEEDINFO() to allow user to enter values for Flight Number, Destination, Distance
& call function CALFUEL() to calculate the quantity of Fuel
A function SHOWINFO() to allow user to view the content of all the data members

Question 2:
Convert the following code into php
class PPP
{
int H:
protected :
int S;
public :
void input (int);
void out();
};

class QQQ : private PPP


{
int T;
protected :
int U;
public :
void indata(int, int);
void outdata();
};

class RRR : public QQQ


{
int M;
public :
void disp();
};

After converting the above code into php. set the value H of class ppp by using the object of
class RRR

HINT:
You must create an object of RRR class and by using that object you must set the any value of
private data member H in class PPP.

You might also like