Define a class Student with data members as rollno and name. Derive a class Fees from student
that has a data member fees and functions to submit fees and generate receipt. Derive another class
Result from Student that displays the marks and grade obtained by the student. Write a program that
extends the class Result so that the final result of the Student is evaluated based on the marks obtained
in tests, activities and sports.
/******************************************************************************
Define a class Student with data members as rollno and name. Derive a class Fees from student
that has a data member fees and functions to submit fees and generate receipt. Derive another class
Result from Student that displays the marks and grade obtained by the student. Write a program that
extends the class Result so that the final result of the Student is evaluated based on the marks obtained
in tests, activities and sports.
*******************************************************************************/
#include <iostream>
using namespace std;
class Student{
  protected:
    int rollno;
    string name;
};
class Fees: public Student{
  private:
    double fees;
  public:
    double submit(){
        cout<<"\nEnter fees: ";
        cin>>fees;
        return fees;
    }
    double receipt(){
        cout<<"\nFees: "<<submit();
    }
};
class Result: public Student{
  private:
    double marks;
    char grade;
  public:
    void display(){
        cout<<"\nMarks: "<<marks;
        cout<<"\nGrade: "<<grade;
    }
};
int main()
{
    Student s;
    Fees f;
    f.submit();
    f.receipt();
    Result r;
    r.display();
    return 0;
}
Comments