C++ Help me fix my code please! I'm missing something and can't figure it out. Code and error picture are below. Original question is in the pictures too. #include using namespace std; class Employee...


C++ Help me fix my code please! I'm missing something and can't figure it out. Code and error picture are below. Original question is in the pictures too.


#include
using namespace std;

class Employee
{
    public:
    string first_name;
    string last_name;
    int monthly_sal;
    int increment;
    Employee()
    {
        first_name="";
        last_name="";
        monthly_sal=0;
        increment=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<>
        this->monthly_sal=0;
        }
        else{
        this->monthly_sal=monthly_sal;
        }
    }
    void setInc(int increment)
    {
        monthly_sal =monthly_sal+(monthly_sal*increment);
    }
    string getFirst_Name()
    {
     return first_name;
    }
    string getLast_Name()
    {
        return last_name;
    }
    int get_salary()
    {
        return monthly_sal;
    }
    int get_increment()
    {
        return increment;
    }
    int get_yearly_salary_before()
    {
        return 12*monthly_sal;
    }
    int get_yearly_salary_after()
    {
        return 12*(monthly_sal+(monthly_sal*increment));
    }
};

int main()
{
  Employee ob;
  ob.increment=1000;
  string first_name,last_name;
  cout<"enter: the="" employee's="" first="" and="" last="" name:="">
  cin>> first_name >> last_name;
  cout<"enter: the="" employee's="" monthly="" salary:="">
  cin >> ob.monthly_sal;
  ob.setSal(ob.monthly_sal);
  cout< first_name="">< "="" "=""><"'s yearly="" salary="" before="" the="" raise="" was="">< ob.get_yearly_salary_before()=""><>
  cout< "="" "="">< last_name=""><"'s yearly="" salary="" after="" the="" raise="" is="">< ob.get_yearly_salary_after()=""><>
  return 0;
}


Create a class called Employee that includes three data members: a first<br>name (type string), a last name (type string), and monthly salary (ty.pe int).<br>The class will have a constructor that initializes the three data members.<br>Include the set and get member functions for each data member. If the monthly<br>salary is not positive, the set function will set it to 0. Also include a<br>member function that returns the yearly salary (i.e. twelve times the monthly<br>salary).<br>Write a test program that prompts the user to enter the first and last<br>name of an employee as well as their monthly salary. The program will then<br>output the yearly salary of the employee, give them a 10 percent raise, and<br>output the yearly salary again.<br>

Extracted text: Create a class called Employee that includes three data members: a first name (type string), a last name (type string), and monthly salary (ty.pe int). The class will have a constructor that initializes the three data members. Include the set and get member functions for each data member. If the monthly salary is not positive, the set function will set it to 0. Also include a member function that returns the yearly salary (i.e. twelve times the monthly salary). Write a test program that prompts the user to enter the first and last name of an employee as well as their monthly salary. The program will then output the yearly salary of the employee, give them a 10 percent raise, and output the yearly salary again.
Problems Detected:<br>The contents of your standard output is incorrect.<br>Given the following was entered from the keyboard:<br>John Smith<br>10000<br>you displayed:<br>Enter:-the-employee's-first-and·last-name: Enter:-the employee's-monthly salary:-John-Smith's•yearly-salary-before-the raise•was-1200<br>John Smith's yearly•salary-after•the raise-is 120120000<br>instead of:<br>Enter:•the employee's-first-and·last name: Enter:•the employee's-monthly•salary:-John Smith's-yearly salary•before the raise•was 1200<br>John•Smith's•yearly•salary•after•the•raise•is•132000J<br>Failed 2 out of 4 test runs.<br>Failed Test Run #1 -<br>The contents of your standard output is incorrect.<br>Interactive Session<br>Hide Invisibles<br>Highlight: None<br>Show Highlighted Only O<br>Expected Result:<br>Your Code's Actual Result:<br>Enter:John- Smithe<br>· the· employee's first·and -last name: Enter:100004<br>·the employee's monthly salary: John- Smith's yearly salary before the raise wa<br>John - Smith's.yearly salary·after the raise is 1320004<br>Enter:John - Smithe<br>· the employee's first and ·last name: · Enter:100004<br>·the employee's monthly salary: John- Smith's yearly salary before the raise wa<br>John - Smith's yearly salary after the raise·is 1201200004<br>

Extracted text: Problems Detected: The contents of your standard output is incorrect. Given the following was entered from the keyboard: John Smith 10000 you displayed: Enter:-the-employee's-first-and·last-name: Enter:-the employee's-monthly salary:-John-Smith's•yearly-salary-before-the raise•was-1200 John Smith's yearly•salary-after•the raise-is 120120000 instead of: Enter:•the employee's-first-and·last name: Enter:•the employee's-monthly•salary:-John Smith's-yearly salary•before the raise•was 1200 John•Smith's•yearly•salary•after•the•raise•is•132000J Failed 2 out of 4 test runs. Failed Test Run #1 - The contents of your standard output is incorrect. Interactive Session Hide Invisibles Highlight: None Show Highlighted Only O Expected Result: Your Code's Actual Result: Enter:John- Smithe · the· employee's first·and -last name: Enter:100004 ·the employee's monthly salary: John- Smith's yearly salary before the raise wa John - Smith's.yearly salary·after the raise is 1320004 Enter:John - Smithe · the employee's first and ·last name: · Enter:100004 ·the employee's monthly salary: John- Smith's yearly salary before the raise wa John - Smith's yearly salary after the raise·is 1201200004

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here