Whats wrong with my function?
[b]Main.cpp[/b]
#include <iomanip>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
#include "Employee.h"
void TerminateApplication();
void DisplayDivider(string outputTitle);
void DisplayApplicationInformation();
string GetInput(string);
int main()
{
DisplayApplicationInformation();
//Employee object
//Prompt user to enter Employee data
Employee info;
DisplayDivider("Employee 1");
string input;
input = GetInput("First Name");
info.setFirstName(input);
input = GetInput("Last Name");
info.setLastName(input);
input = GetInput("Gender");
info.setGender(input[0]);
input = GetInput("Dependents");
info.setDependents(atoi(input.c_str())); //converting
input = GetInput("Annual Salary");
info.setAnnualSalary(atof(input.c_str()));
DisplayDivider("Employee Information ");
cout << "_____________________________________________________" << endl;
info.displayEmployee();
DisplayDivider("Employee Information ");
cout << "_____________________________________________________" << endl;
Employee info2("Mary", "Noia", 'F', 2, 150000.0);
info2.displayEmployee();
DisplayDivider("Benefit Information");
info2.benefit("HealthInsurance", 1000, 1);
DisplayDivider("Benefits Results");
info2.benefit.displayBenefits();
info2.displayEmployee();
TerminateApplication();
system("pause");
return 0;
}
void DisplayApplicationInformation()
{
cout << "Name: Tony Almanza" << endl << endl;
}
void DisplayDivider(string outputTitle)
{
cout<<"**************** " << outputTitle << "****************"<<endl;
}
void TerminateApplication()
{
cout<<"The end of the CIS247 Week 4 Lab"<<endl;
}
string GetInput(string inputType)
{
string strInput;
cout << "Please enter your " << inputType <<" ";
//Get user input and return the value to calling function
cin >> strInput;
return strInput;
}
[b]Benefit.h[/b]
#include <iomanip>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
class Benefit
{
private:
string healthInsurance;
double lifeInsurance;
int vacation;
public:
Benefit();
Benefit(string health, double life, int vacation);
void displayBenefits();
string getHealthInsurance();
void setHealthInsurance(string hIns);
double getLifeInsurance();
void setLifeInsurance(double lifeIns);
int getVacation();
void setVacation(int vaca);
};
[b]Benefit.cpp[/b]
#include "Benefit.h"
Benefit::Benefit(){
healthInsurance = "Not given";
lifeInsurance = 0;
vacation = 0;
}
Benefit::Benefit(string health, double life, int vaca){
health = healthInsurance;
life = lifeInsurance;
vaca = vacation;
}
void Benefit::displayBenefits(){
cout << "Health Insurance: " << healthInsurance << endl;
cout << "Life Insurance: " << lifeInsurance << endl;
cout << "Vacation: " << vacation << endl;
}
string Benefit::getHealthInsurance(){
return healthInsurance;
}
void Benefit::setHealthInsurance(string hIns){
healthInsurance = hIns;
}
double Benefit::getLifeInsurance(){
return lifeInsurance;
}
void Benefit::setLifeInsurance(double lifeIns){
lifeInsurance =lifeIns;
}
int Benefit::getVacation(){
return vacation;
}
void Benefit::setVacation(int vaca){
vacation = vaca;
}

New Topic/Question
Reply



MultiQuote




|