Hello, the program built below has some errors-refuses to let me compile and out
ID: 3638068 • Letter: H
Question
Hello, the program built below has some errors-refuses to let me compile and output the data necessary. If possible, run the program to see where the problems are occurring. I am attempting to run the program in visual studio 2010 express.#include <iostream>
using namespace std;
class employee
{
private:
int id, maxHours;
float payRate;
public:
void setInfo (int pin, float pay, int hours)
{
id = pin;
payRate = pay;
maxHours = hours;
}
void viewInfo () // No parameters req.
{
cout << id;
cout << endl << payRate;
cout << endl << maxHours;
cout<<"enter the new valuse for the id:; "<< cout << "Enter employee 3 digit ID: ";
cin >> pin;
cout << "Enter employee pay rate: ";
cin >> pay;
cout << "Enter employee max hours: ";
cin >> hours;
empInfo[pin].setInfo(pin, pay, hours);
}
};
int main ( )
{
int pin, hours, record;
float pay;
int ch;
char ans;
employee empInfo[1000];
cout<<"1.ADD EMP 2.MODIFY EMP 3.DELETE EMP 4.EXIT";
cout<<"enter the choice";
cin>>ch;
switch(ch)
{
case 1:
{
cout << "Enter employee 3 digit ID: ";
cin >> pin;
cout << "Enter employee pay rate: ";
cin >> pay;
cout << "Enter employee max hours: ";
cin >> hours;
empInfo[pin].setInfo(pin, pay, hours);
}
case 2:
{
cout << "Enter the employee ID# of the record you wish to modify ";
cin >> record;
empInfo[record].viewInfo();
}
case 3:
{
cout << "Enter the employee ID# of the record you wish to modify ";
cin >> record;
empInfo[pin].setInfo(0,0,0);
}
case 4:
{
return ;
}
}
Explanation / Answer
change this statement empInfo[pin].setInfo("","",""); to empInfo[pin].setInfo(0,0,0);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.