No member function declared in class

Hello, when I try to compile this program, it says "no void Undergraduate::default_input()’ member function declared in class ‘Undergraduate’
void Undergraduate::default_input(){

First is the header file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef UNDERGRADUATE_H
#define UNDERGRADUATE_H

#include <iostream>
#include "program.h"
#include "name.h"
#include "date.h" 

using namespace std;

class Undergraduate{
        public:

                Undergraduate(); //default constructor

                Undergraduate(Name, Date, Program); //constructor with three arguments

                void default_input(); //input method for default constuctor

                void input(); //input method for undergraduate constructor

                void display1(); //display method

                void display2();

                void inputgender();

                void inputstatus();

                void inputcredit();

                void inputgpa();

                void inputgradterm();

                void inputgradyear();

                //Mutator Methods

                void setSName(Name);

                void setBDay(Date);

                void setProgram(Program);

                bool setgender(char);

                bool setstatus(string);

                bool setgpa(double);

                void setcredit(int);

                bool setgradterm(string);

                bool setgradyear(int);
  //Accessor Methods

                char getgender();

                string getstatus();

                double getgpa();

                int getcredit();

                string getgradterm();

                int getgradyear();

        private:

        Name sname1;

        Name name1;
        Name name2;

        Program sprogram1;
        Program pgm1;
        Program pgm2;

        Date bday1;

        Date date1;
        Date date2;

        string status, gradterm;

        char gender;

        int credit, gradyear;

        double gpa;
};

#endif


This is the main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#include "undergraduate.h"
//default constructor
Undergraduate::Undergraduate(){

        name1 = sname1;
        date1 = bday1;
        pgm1 = sprogram1;

        gender = 'm';
        status = "Active";
        credit = 0;
        gpa = 0.0;
        gradyear = 2016;
        gradterm = "Spring";
}

//constructor with objects as arguments
Undergraduate::Undergraduate(Name sname2, Date bday2, Program sprogram2){

        name2 = sname2;

        date2 = bday2;

        pgm2 = sprogram2;
}

//display method invoking display methods of other objects created by default constructors of other classes
//display method using accessor methods
void Undergraduate::display1(){

        name1.display();
        date1.display();
        pgm1.display();
        cout << "GENDER:" << getgender() << endl;
        cout << "STATUS: " << getstatus() << endl;
        cout << "CREDIT: " << getcredit() << endl;
        cout << "GPA: " << getgpa() << endl;
        cout << "GRADTERM: " << getgradterm() << endl;
        cout << "GRADYEAR: " << getgradyear() << endl;

}

//display method invoking display methods of other objects created by constructors of other classes
//display method using accessor methods
void Undergraduate::display2(){

        name2.display();
        date2.display();
        pgm2.display();
        cout << "GENDER:" << getgender() << endl;
        cout << "STATUS: " << getstatus() << endl;
        cout << "CREDIT: " << getcredit() << endl;
        cout << "GPA: " << getgpa() << endl;
        cout << "GRADTERM: " << getgradterm() << endl;
        cout << "GRADYEAR: " << getgradyear() << endl;

}

//input method
void Undergraduate::default_input(){

        name1.input();
        date1.input();
        pgm1.input();
        inputgender();
        inputstatus();
        inputcredit();
        inputgpa();
        inputgradyear();
        inputgradterm();
}

//input method
void Undergraduate::input(){

        name2.input();
        date2.input();
        pgm2.input();
        inputgender();
        inputstatus();
        inputcredit();
        inputgpa();
        inputgradyear();
        inputgradterm();
}
//mutator methods
void Undergraduate::setSName(Name sname2){

        name2 = sname2;
}

void Undergraduate::setBDay(Date bday2){

        date2 = bday2;
}


void Undergraduate::setProgram(Program sprogram2){

        pgm2 = sprogram2;
}
bool Undergraduate::setgender(char g){

        bool validate = false;

           if ( g == 'm' || g == 'M' || g == 'f' || g == 'F'){
                        gender = g;
                        validate = true;
                }
                        return (validate);
}

bool Undergraduate::setstatus(string s){

        bool validate= false;

                if ( s == "Active" || s == "active" || s == "Withdrawn" || s == "withdrawn" || s == "Sabbatical" || s == "sabbatical" || s == "graduated" || s == "Graduated"){
                        status = s;
                        validate = true;
                }

                return (validate);
}

void Undergraduate::setcredit(int c){

        credit = c;
}


bool Undergraduate::setgpa(double G){

        bool validate = false;
                if ( G > 1.0 && G <= 4.0){
                        gpa = G;
                        validate = true;
                }

                return (validate);
}
bool Undergraduate::setgradterm(string t){

        bool validate = false;

                if ( t == "Fall" || t == "fall" || t == "Spring" || t == "spring"){
                        gradterm = t;
                        validate = true;
        }

                return (validate);
}


bool Undergraduate::setgradyear(int yr){

        bool validate = false;
          if ( yr > 2016 &&  yr < 2020){
                        gradyear = yr;
                        validate = true;
                }

                return (validate);
}
//individual input methods for datatypes not included in other classes i.e. gender, status, credit, gpa, gradyear, gradterm     
void Undergraduate::inputgender(){
        char g;
        do {
                cout << "Please state your gender. If you are male, type m. If you are female, type f." << endl;
                cin >> g;
        } while (!setgender(g));
}


void Undergraduate::inputstatus(){
        string s;
        do{
                cout << "Please enter your status. Type in one of the following (Active/Graduated/Withdrawn/Sabbatical): ";
                cin >> s;
        } while (!setstatus(s));
}
void Undergraduate::inputcredit(){
        int c;
        cout << "Please enter your number of credits." << endl;
        cin >> c;
}

void Undergraduate::inputgpa(){
        double G;
        do{
                cout << "Please enter your GPA." << endl;
                cin >> G;
        }while (!setgpa(G));
}

void Undergraduate::inputgradterm(){
        string t;
        do{
                cout << "Please enter your expected graduation term. Type in (Fall/Spring): ";
                cin >> t;
        }while(!setgradterm(t));
}


void Undergraduate::inputgradyear(){
        int yr;
        do{
                cout << "Please enter your expected graduation year." << endl;
                cin >> yr;
  } while (!setgradyear(yr));

}

//accessor methods      
char Undergraduate::getgender(){
        return gender;
}

string Undergraduate::getstatus(){
        return status;
}
int Undergraduate::getcredit(){
        return credit;
}

double Undergraduate::getgpa(){
        return gpa;
}
string Undergraduate::getgradterm(){
        return gradterm;
}

int Undergraduate::getgradyear(){
        return gradyear;
}
is there something I'm doing wrong?
Last edited on
Also, just in case anyone wants the driver program too, here it is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "date.h"
#include "program.h"
#include "name.h"
#include "undergraduate.h"

main(){

        Name sname1; // create object sname1 for class Name using default constructor

        Name sname2("Jane", 'A', "Doe"); //create object sname for class Name using constructor that takes arguments

        Date bday1; // create object bday1 for class Date using the default constructor

        Date bday2(10, 2, 2015); //create object bday2 for class Date using constructor that takes arguments

        Program sprogram1; //create object sprogram1 for class Program using the default constructor

        Program sprogram2("Psychology","Dance","BS","Westchester"); // create object sprogram2 for class Program using a constructor that take arguments

        Undergraduate s1;

        Undergraduate s2(sname2,bday2,sprogram2); //constructor that takes objects as arguments

        sname1.display();
        sname2.display();

        sname2.input();

        sname1.display();
        sname2.display();

        bday1.display();
        bday2.display();

        bday2.input();

        bday1.display();
        bday2.display();

        sprogram1.display();
        sprogram2.display();

        sprogram2.input();

        sprogram1.display();
        sprogram2.display();

        cout << "\n\nDEFAULT STUDENT INFORMATION:" << endl;
        s1.display1();
        s1.default_input();
        cout << "\n\nUPDATED STUDENT DEFAULT INFORMATION: " << endl;
        s1.display1();

        s2.input();
        cout << "\n\nSUMMARY OF STUDENT INFORMATION: " << endl;
        s2.display2();

}

Topic archived. No new replies allowed.