Answer to Question #213138 in C++ for Hemambar

Question #213138

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.


1
Expert's answer
2021-07-19T16:58:23-0400
/******************************************************************************
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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS