I am trying to make a program that computes gross by using a class and three functions. When I try to run it, it gives me this error I think something is wrong with my set function and my int main function, any help would be appreciated, I think it has to do with template.
#include <iostream>
using namespace std;
double payRate;
int hours;
class Employee
{
public:
void set(double payRate, int hours);
double pay();
void display();
private:
int hours;
double payRate;
double Gross;
};
int main()
{
Employee wage;
cout << "What is the pay rate:";
cin >> payRate;
cout << "How many hours worked:";
cin >> hours;
wage.set(payRate, hours);
wage.display();
}
void Employee::set(double payRate, int hours)
{
cin >> payRate;
cin >> hours;
}
double Employee::pay()
{
return Gross= payRate* hours;
}
void Employee::display()
{
cout << "The Gross wage is: " << Gross;
}