Member Avatar for pepsi123

I keep receiving these error messages:
Applicant.cpp:25:6: error: prototype for âvoid Applicant::setDeposit(char)â does not match any in class âApplicantâ
Applicant.h:12:7: error: candidate is: void Applicant::setDeposit(bool)
Applicant.cpp:29:6: error: prototype for âchar Applicant::getDeposit()â does not match any in class âApplicantâ
Applicant.h:13:7: error: candidate is: bool Applicant::getDeposit()
Applicant.cpp:71:5: error: prototype for âint Applicant::addPoints(int)â does not match any in class âApplicantâ
Applicant.h:22:7: error: candidate is: void Applicant::addPoints(int)
Applicant.cpp:107:5: error: prototype for âint Applicant::deductPoints(int)â does not match any in class âApplicantâ
Applicant.h:23:7: error: candidate is: void Applicant::deductPoints(int)

I have checked and checked my header file, but all of the names/prototypes are the same. I'm not sure why I keep getting these errors.

//////////////////////////////////////////////////////////////////////////////////////////////////////////

//Implementation file
//Implements the class Applicant member functions

#include "Applicant.h"

/* set name and get name*/
void Applicant::setName(string firstName, string lastName)
{
        name = firstName + " " + lastName;
}
string Applicant::getName()
{
        return name;
}
/* set hours and get hours*/
void Applicant::setHours (int newHours)
{
        hours = newHours;
}
int Applicant::getHours()
{
        return hours;
}
/*set deposit and get deposit*/
void Applicant::setDeposit(bool  newDeposit)
{
        deposit = newDeposit;
}
bool Applicant::getDeposit()
{
        if (deposit == 200)
                return true;
        else
                return false;
}
/* Set and get payMonth*/
void Applicant::setPayMonth(int newPayMonth)
{
        payMonth = newPayMonth;
}
int Applicant::getPayMonth()
{
        return payMonth;
}
/* Set and get payDay*/
void Applicant::setPayDay(int newpayDay)
{
        payDay = newpayDay;
}
int Applicant::getPayDay()
{
        return payDay;
}
/* Set and get housing*/
void Applicant::setHousing(string newHousing)
{
        housing = newHousing;
}
string Applicant::getHousing()
{
        return housing;
}
/* Set and get sex*/
void Applicant::setSex(char newSex)
{
        sex = newSex;
}
char Applicant::getSex()
{
        return sex;

}
/* Add any necessary points to student's RSVP points*/
int Applicant::addPoints(int gpa)
{
        int addpoints=0;
        int crdhours=0;
        if (gpa >= 3.80)
                return addpoints+20;
        else  if (gpa >= 3.50)
                        return addpoints+18;
                else if (gpa >= 3.20)
                                return addpoints+16;
                        else if (gpa >= 3.00)
                                        return addpoints+14;
                                else if (gpa >= 2.80)
                                                return addpoints+12;
                                        else if (gpa >= 2.60)
                                                        return addpoints+10;
                                                else if (gpa >= 2.40)
                                                                return addpoints+8;
                                                        else if (gpa >= 2.20)
                                                                        return addpoints+6;
                                                                else if (gpa >= 2.00)
                                                                                return addpoints+4;
        else if (gpa >= 0.00)
                return addpoints+2;
        if (crdhours <= 29)
              return crdhours+10;
        else if (crdhours <= 59)
                        return crdhours+8;
                else if (crdhours <= 59)
                                return crdhours+6;
                        else if (crdhours >= 90)
                                        return crdhours+4;
        points = addpoints+crdhours;
        return points;
}
/* Deduct any points from student's RSVP points*/
int Applicant::deductPoints(int minuspoints)
{
        points = points - minuspoints;
        return points;
}
/*Get the total points for the student*/
int Applicant::getPoints()
{
        return points;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////

//SPECIFICATION FILE
#include <string>
using namespace std;
class Applicant
{
public:
        // public member functions
        void setName(string, string);
        string getName();
        void setHours(int);
        int getHours();
        void setDeposit(bool);
        bool getDeposit();
        void setPayMonth(int);
        int getPayMonth();
        void setPayDay(int);
        int getPayDay();
        void setHousing(string);
        string getHousing();
        void setSex(char);
        char getSex();
        int addPoints(int);
        int deductPoints(int);
        int getPoints();
private:
        //11 private data members
        string name;
        int hours;
        int zip;
        bool deposit;
        int payMonth;
        int payDay;
        string housing;
        char sex;
        int points;
};

line 31: deposit is declared as bool, so it can't contain the value shown on line 31. The test will alays be false because it can only be 1 or 0.

I compiled it on MS-Windows and didn't get any of the errors you reported. The only probledm was what I mentioned above, which is a warning not an error.

Member Avatar for pepsi123

Ok I was able to correct that error. Thank you, but I run my program in the unix server and I keep getting this error:

Applicant.cpp:72:5: error: prototype for âint Applicant::addPoints(int)â does not match any in class âApplicantâ
Applicant.h:22:7: error: candidate is: void Applicant::addPoints(int)
Applicant.cpp:108:5: error: prototype for âint Applicant::deductPoints(int)â does not match any in class âApplicantâ
Applicant.h:23:7: error: candidate is: void Applicant::deductPoints(int)

But I've double checked it and it is still giving me errors. Could it be the server beacuse I'm not seeing any errors.

Thank you so much for your help, it helped a lot!

What compiler are you using? gcc or g++ or something else? I don't have a *nix os so I can't really help you with that. Maybe Mike or someone else can help you.

Member Avatar for pepsi123

Putty.exe and to compile we use g++

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.