C++ Help me fix my code please! I'm missing something and can't figure it out. Code and error picture are below. #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<0)         this->monthly_sal=0;         this->monthly_sal=monthly_sal;     }     void setInc(int increment)     {         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+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;   cout<< first_name << " " <

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ Help me fix my code please! I'm missing something and can't figure it out. Code and error picture are below.

#include <iostream>
 
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<0)
        this->monthly_sal=0;
        this->monthly_sal=monthly_sal;
    }
    void setInc(int increment)
    {
        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+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;
  cout<< first_name << " " <<last_name <<"'s yearly salary before the raise was "<< ob.get_yearly_salary_before() <<endl;
  cout<<first_name << " " << last_name <<"'s yearly salary after the raise is "<< ob.get_yearly_salary_after() <<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::John-Doe's-yearly-salary-before-the-raise was--276
John-Doe's yearly salary after-the-raise-is 11724
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•0d
Failed 3 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:William - Schneierd
· the employee's first and - last name: · Enter: -5004
· the employee's monthly salary: William-Schneier's yearly salary before the ra
William- Schneier's yearly.salary-after the raise-is ed
Your Code's Actual Result:
Enter:William - Schneiere
- the employee's first·and - last-name : · Enter:-500e
·the employee's monthly salary: William-Schneier's yearly salary before the ra
William- Schneier's yearly.salary.after the raise is:60004
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::John-Doe's-yearly-salary-before-the-raise was--276 John-Doe's yearly salary after-the-raise-is 11724 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•0d Failed 3 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:William - Schneierd · the employee's first and - last name: · Enter: -5004 · the employee's monthly salary: William-Schneier's yearly salary before the ra William- Schneier's yearly.salary-after the raise-is ed Your Code's Actual Result: Enter:William - Schneiere - the employee's first·and - last-name : · Enter:-500e ·the employee's monthly salary: William-Schneier's yearly salary before the ra William- Schneier's yearly.salary.after the raise is:60004
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education