Originally Posted by
matsp
Code:
#ifndef Life_Insurance_Header
#define Life_Insurance_Header
#include "Life_Insurance_Header.h"
This looks a bit wrong. Either the include-guards are wrong, or you meant to include something else? Because to me, it looks like you are including the very same header file you were just in...
--
Mats
i fixed that, but this what am doing is a work in progress for an oop class am doing at school. Here is the update to what i have now.
Code:
#ifndef Life_Insurance_Header
#define Life_Insurance_Header
#include "Insurance_header.h"
class LifeInsurance: public MainIns{
private:
string per_name;
int per_age;
string fl_address;
string sl_address;
string occupation;
int val_per;// estimate value of an object
public:
LifeIns();//constructor
~LifeIns();//destructor
//Accessors
string getPerName();
int getPerAge();
string getFLAdress();
string getSLAdress();
string getOccupation();
float getValPer();
//Mutators
void setPerName(string);
void setPerAge(int);
void setFLAdress(string);
void setSLAdress(string);
void setOccupation(string);
void setValPer(float);
//bool DoYouSmoke (LifeInsurance &);//Accepts an object and returns true or false if the policy holder is a smoker or not
//void AccDeathDismenCov (LifeInsurance &);//Accepts an object checks if the client needs accidental death and dismenberment coverage
float calPremium(float);//Function that accepts the value of the person to be insured to calculate the premium of the person
};
#endif
Code:
#ifndef MotorVehicle_Insurance_header
#define MotorVehicle_Insurance_header
#include "Insurance_Header.h"
class MotVehicle_Ins: public MainIns {
private:
string veh_mod;
string veh_make;
int year;
int license_num;
int chasis_num;
float est_veh_val;
string fuel_type;
string body_type;
int cc_rating;
int seat_cap;
string owner;
public:
MotVehicle_Ins();
~MotVehicle_Ins();
//Accessors
string getVehMod();
string getVehMake();
int getYear();
int getChasisNum();
int getLicenseNum();
float getEstVehVal();
string getFuelType();
string getBodyType();
int getCCRating();
int getSeatCap();
string getOwner();
//Mutators
void setVehMod(string);
void setVehMake(string);
void setYear(int);
void setChasisNum(int);
void setLicenseNum(int);
void setEstVehVal(float);
void setFuelType(string);
void setBodyType(string);
void setCCRating(int);
void setSeatCap(int);
void setOwner(string);
//bool AccidentPrevYear(MotVehicle_Ins &);
//bool BurgularAlarm(MotVehicle_Ins &);
float CalculatePrem (float);//Accepts the value of the car then calculates the premium depending on certain criteria then returns a float
};
#endif
Code:
#ifndef Insurance_header
#define Insurance_header
#include "Date.h"
#include <string>
//Parent Class
class MainIns: public Date {
private:
int pol_num;//policy number
//string pol_hol;//policy holder
int eff_date;//effective date of policy
int exp_date;//expiry date of policy
float ins_prem;//premimum for the policy
public:
MainIns();//default constructor, used to instantiate the object
~MainIns();//Destructor
//Accessors
int getPolNum();
//string getPolHol();
int getEffDate();
int getExpDate();
float getInsPrem();
//Mutators
void setPolNum(int);
//void setPolHol(string);
void setEffDate(int);
void setExpDate(int);
void setInsPrem(float);
};
#endif
Code:
#ifndef Insurance_header
#define Insurance_header
#include "Date.h"
#include <string>
//Parent Class
class MainIns: public Date {
private:
int pol_num;//policy number
//string pol_hol;//policy holder
int eff_date;//effective date of policy
int exp_date;//expiry date of policy
float ins_prem;//premimum for the policy
public:
MainIns();//default constructor, used to instantiate the object
~MainIns();//Destructor
//Accessors
int getPolNum();
//string getPolHol();
int getEffDate();
int getExpDate();
float getInsPrem();
//Mutators
void setPolNum(int);
//void setPolHol(string);
void setEffDate(int);
void setExpDate(int);
void setInsPrem(float);
};
#endif
Code:
#include "Date.h"
#include<iostream>
using namespace std;
Date :: Date()
{
day=1;
month=1;
year=1;
}
Date :: Date(int d, int m, int y)
{
day= d;
month= m;
year= y;
}
void Date:: setDate1(int d, int m, int y)
{
day= d;
month= m;
year= y;
}
int Date :: getDay()const
{
if (day>=1 && day<=31){
return day;
}//end if
}// ends fucntion
int Date :: getMonth() const
{
if(month>=1 && month<=12)
{
return month;
}//end if
}//ends function
int Date :: getYear() const
{
return year;
}
Remember in the main insurance i had effect date attributes and expiry date, instead of using those i inserted a date interface where i can use that to intialize those dates. I cant wait to finish this so i can feel pleased within my self as a beginner programmer.