Question: Create Student class as an abstract class in C++. Inherit GraduateStudent and PostGraduateStudent and ResearchStudent classes from Student class. Define proper constructors, destructors and functions related to attendance and examination result. Make necessary assumptions wherever required.

I am not the same guy who posted this http://www.daniweb.com/software-development/cpp/threads/464146/cpp-program , I just reached here following the link from google.

This is not out of lazinees but because I am unable to assume the requirements of this program. Here is a little part that I have already completed, I just need simple assumptions that you guys can provide which will help me complete it. Its urgent. Thank you in advance.

#include<iostream>
#include<conio.h>

using namespace std;

class Student {
    public:
    Student();
    ~Student();
    virtual void attendence();
    virtual void examination();
};

class GraduateStudent:public Student {
    GraduateStudent() {
    }

    ~GraduateStudent() {
    }
};

class PostGraduateStudent:public Student {
    PostGraduateStudent() {
    }

    ~PostGraduateStudent() {
    }
};

class ResearchStudent:public Student {
    ResearchStudent() {
    };

    ~ResearchStudent() {
    }
};

int main() {
    return 0;
}

So what do you need? Can you assume what a college student is and what you need to have for members and functions?

Can you assume what a college student is and what you need to have for members and functions?

Yes I can but my thinking only takes me to higher level where I can use file handling and make funtions that can store and retrive students data into seprate files and stuff like that.

I am looking for simple things, maybe something I am currently not able to figure out which could be done with just 2-3 functions and more simpler as compared to my current thoughts

class student

class student
{
protected:
char name[30];
int attendence;
float gpa;
public:
stuent(){}
student(char n[],int a, flat g):attendence(a), gpa(g){strcpy(name, n);}
~student(){}
virtual get_attendence()
{
cout<<"Enter his atendence (out of 50) : ";
cin>>attendence;
}
virtual get_result()
{
cout<<"Enter your Gpa (out of 4.00) : ";
cin>>gpa;
}
};

this is the base class for student now drive classes with extra data.
i,e.
for graduate char degree[20];
for postgraduate char university[];
for reasearch int publications;

Thanks. Its a job done.

#include<iostream>
#include<conio.h>
#include<string.h>

using namespace std;

class Student {
    protected:
        char name[30];
        int matten, atten;
        float mgpa, gpa;
        int i;
        int sub[5];

    public:
        Student() {}
        Student(int a, float g) {
            mgpa    = g;
            matten  = a;
        }

        ~Student(){}

        virtual void stuName() {
            cout<<"Enter students name :: ";
            cin>>name;
        }

        virtual int attendence() {
            cout<<"Enter attendence (out of 50) : ";
            cin>>atten;

            if (atten<=matten) {
                cout<<"This student is disqualified from apperaing in exams. Minimum attenedce required is "<<matten;
                return 0;
            }
            return 1;
        }

        virtual void examination() {
            cout<<"Enter marks of five subjects :: ";
            for (i=0; i<5; i++)
                cin>>sub[i];
        }

        virtual void gpaCal() {
            gpa = sub[0]+sub[1]+sub[2]+sub[3]+sub[4];
            gpa = gpa/50;
        }

        virtual void printResult() {
            if (gpa>mgpa) {
                cout<<name<<", you passed with a gpa of "<<gpa;
            } else {
                cout<<name<<", you failed with a gpa of "<<gpa;
            }
        }
};

class GraduateStudent:public Student {

    public:
        GraduateStudent(int a, float g) {
            mgpa    = g;
            matten  = a;
        }

        ~GraduateStudent() {
        }
};

class PostGraduateStudent:public Student {

    public:
        PostGraduateStudent(int a, float g) {
            mgpa    = g;
            matten  = a;
        }

        ~PostGraduateStudent() {
        }
};

class ResearchStudent:public Student {

    public:
        ResearchStudent(int a, float g) {
            mgpa    = g;
            matten  = a;
        }

        ~ResearchStudent() {
        }
};

int main() {
    int ret, ch=0;
    Student *stu;
    GraduateStudent gStu(35, 3.5);
    PostGraduateStudent pgStu(25, 4);
    ResearchStudent rStu(15, 5);

    do {
        cout<<"\n\nMenu :: ";
        cout<<"\n1. Graduate Student";
        cout<<"\n2. Post Graduate Student";
        cout<<"\n3. Research Student";
        cout<<"\n4. Exit";
        cout<<"\nEnter your choice :: ";
        cin>>ch;

        switch(ch) {
            case 1:
                stu = &gStu;
                stu->stuName();
                ret = stu->attendence();
                if (ret) {
                    stu->examination();
                    stu->gpaCal();
                    stu->printResult();
                }
                break;
            case 2:
                stu = &pgStu;
                stu->stuName();
                ret = stu->attendence();
                if (ret) {
                    stu->examination();
                    stu->gpaCal();
                    stu->printResult();
                }
                break;
            case 3:
                stu = &rStu;
                stu->stuName();
                ret = stu->attendence();
                if (ret) {
                    stu->examination();
                    stu->gpaCal();
                    stu->printResult();
                }
                break;
            case 4:
                break;
            default:
                cout<<"\nInvalid input. Please try again";
        }
    } while(ch!=4);

    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.