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" <

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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

Problems Detected:
The contents of your standard output is incorrect.
Given the following was entered from the keyboard:
John Doed
|-23의
you displayed:
Enter: the employee's-first-and·last-name: Enter: the employee's monthly•salary: salary-before the•raise-was 0d
yearly salary•after•the-raise•is-0d
instead of:
Enter: the employee's first-and•last-name: Enter:•the employee's-monthly salary:-John Doe's•yearly-salary-before-the-raise was 0d
John-Doe's-yearly-salary-after•the-raise-is 0J
Failed 4 out of 4 test runs.
Failed Test Run #1
The contents of your standard output is incorrect.
Interactive Session - W v
Hide Invisibles
Highlight: None
Show Highlighted Only O
Expected Result:
Enter:John· Smithe
Your Code's Actual Result:
· 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::salary·before the raise was:0e
yearly salary after the raise is:ed
Transcribed Image Text:Problems Detected: The contents of your standard output is incorrect. Given the following was entered from the keyboard: John Doed |-23의 you displayed: Enter: the employee's-first-and·last-name: Enter: the employee's monthly•salary: salary-before the•raise-was 0d yearly salary•after•the-raise•is-0d instead of: Enter: the employee's first-and•last-name: Enter:•the employee's-monthly salary:-John Doe's•yearly-salary-before-the-raise was 0d John-Doe's-yearly-salary-after•the-raise-is 0J Failed 4 out of 4 test runs. Failed Test Run #1 The contents of your standard output is incorrect. Interactive Session - W v Hide Invisibles Highlight: None Show Highlighted Only O Expected Result: Enter:John· Smithe Your Code's Actual Result: · 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::salary·before the raise was:0e yearly salary after the raise is:ed
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY