1 Replies - 539 Views - Last Post: 03 October 2012 - 11:35 PM Rate Topic: -----

#1 Antoniodab  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-October 12

Error C2064

Posted 03 October 2012 - 10:24 PM

I keep getting this error, Term does not evaluate to a function taking 3 arguments.

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;
}







Is This A Good Question/Topic? 0
  • +

Replies To: Error C2064

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3452
  • View blog
  • Posts: 10,655
  • Joined: 05-May 12

Re: Error C2064

Posted 03 October 2012 - 11:35 PM

Paste in the complete error, including which line number and which file.

There is not quite enough information in the code that you posted. For example, you use an Employee class that seems to be declared in Employee.h, but you didn't give us that code for that.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1