Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am using Microsoft visual studio express 2012 and am using the C++ language...

ID: 3534062 • Letter: I

Question

I am using Microsoft visual studio express 2012 and am using the C++ language...I put the question in red...

Your boss, Juliet Jones, is getting married and decides to change her
name. Complete the following program so that you can type in the new name for
the boss:
int main()
{
Employee boss("Juliet, Jones", 45000.00);
// Your code goes here; leave the code above and below unchanged

cout << "Name: " << boss.get_name() << " ";
cout << "Salary: " << boss.get_salary() << " ";
return 0;
}
The problem is that there is no set_name member function for the Employee class.
Hint: Make a new object of type Employee with the new name and the same salary.
Then assign the new object to boss.

Explanation / Answer

int main()

{

Employee boss("Juliet, Jones", 45000.00);

// Your code goes here; leave the code above and below unchanged


cout << "Name: " << boss.get_name() << " ";

cout << "Salary: " << boss.get_salary() << " ";

char name[20];

int salary;

cout << "Enter new name : ";

gets(name);

cout << "Enter Salary : ";

cin >> salary;

Employee temp(name,salary);

boss = temp;

cout << "Name: " << boss.get_name() << " ";

cout << "Salary: " << boss.get_salary() << " ";

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote