Help me correct my C++ code please! Pictures included. My current code with the error picture; #include using namespace std; class Employee { public: string first_name; string last_name; int monthly_sal; Employee() { first_name=""; last_name=""; monthly_sal=0; } void setFirst_Name(string first_name) { this->first_name=first_name; } void setLast_Name(string last_name) { this->last_name=last_name; } void setSal(int monthly_sal) { if(monthly_sal<0) this->monthly_sal=0; this->monthly_sal=monthly_sal; } string getFirst_Name() { return first_name; } string getLast_Name() { return last_name; } int get_salary() { return monthly_sal; } int get_yearly_salary() { return 12*monthly_sal; } }; int main() { Employee ob; string first_name,last_name; int monthly_sal; cout<<"Enter: the employee's first and last name: "; cin>> last_name; cout<<"Enter: the employee's monthly salary: "; cin >> monthly_sal; cout<<"salary before the raise was 0" <
Help me correct my C++ code please! Pictures included. My current code with the error picture;
#include <iostream>
using namespace std;
class Employee
{
public:
string first_name;
string last_name;
int monthly_sal;
Employee()
{
first_name="";
last_name="";
monthly_sal=0;
}
void setFirst_Name(string first_name)
{
this->first_name=first_name;
}
void setLast_Name(string last_name)
{
this->last_name=last_name;
}
void setSal(int monthly_sal)
{
if(monthly_sal<0)
this->monthly_sal=0;
this->monthly_sal=monthly_sal;
}
string getFirst_Name()
{
return first_name;
}
string getLast_Name()
{
return last_name;
}
int get_salary()
{
return monthly_sal;
}
int get_yearly_salary()
{
return 12*monthly_sal;
}
};
int main()
{
Employee ob;
string first_name,last_name;
int monthly_sal;
cout<<"Enter: the employee's first and last name: ";
cin>> last_name;
cout<<"Enter: the employee's monthly salary: ";
cin >> monthly_sal;
cout<<"salary before the raise was 0" <<endl;
cout<<"yearly salary after the raise is 0" <<endl;
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images