Page 156 - C++
P. 156

2)  A function CalcFare() to calculate Fare as per the following criteria:

        Type                             Fare

        ‘O’                          15*Distance

        ‘E’                          20*Distance

        ‘L’                          24*Distance

        1)  A function Allocate() to allow user to enter values for Busno, From, To, Type and Distance. Also, this
            function should call CalcFare() to calculate Fare.
        2)  A function Show() to display the content of all the data members on screen.

         (d) Consider the following C++ code and answer the questions from (i) to (iv):                      (4)

        class Personal

        {

               int Class,Rno;
               char Section;


               protected:
                       char Name[20];


               public:
                       Personal();

                       void Pentry();

                       void Pdisplay();

        };

        class Marks: private Personal

        {

               float M[5];

               protected:

                       char Grade[5];

               public:

                       Marks();

                       void Mentry();

                       void Mdisplay();

        };

        class Result: public Marks
   151   152   153   154   155   156   157   158   159   160   161