1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Yuri [45]
3 years ago
12

Write the class definition for a class named Employee. The class should include data members for an employee object%u2019s name

and salary. (The salary will be an integer). The class should contain two member functions: the constructor and a function that allows a program to assign values to the data members.
Step 2:

Add two member functions to the Employee class. One member function should allow any program using an employee object to view the contents of the salary data member. The other member function should allow the program to view the contents of the employee name data member. (Hint: Have the member function simply return the contents of the appropriate data member.)

Sep 3:

Add another member function to the Employee class. The member function should calculate an employee object%u2019s new salary, based on a raise percentage provided by the program using the object. Before calculating the raise, the member function should verify that the raise percentage is greater than or equal to zero. If the raise percentage is less than zero, the member function should display an error message.

Step 4:

The instructions to create an employee object, assign values to the object, display the name and current salary, calculate the new salary, and then display the new salary are missing from the program. Complete the program, using these comments as a guide.
Computers and Technology
1 answer:
kykrilka [37]3 years ago
7 0

Answer:

see explaination

Explanation:

#include <iostream>

#include <string>

using namespace std;

class Employee

{

string name;

int salary;

public: Employee()

{

}

Employee(string name, int salary)

{

this->name=name;

this->salary=salary;

}

void setName(string name)

{

this->name=name;

}

void setSalary(int sal)

{

this->salary=sal;

}

string getName()

{

return name;

}

int getSalary()

{

return salary;

}

void raiseSalary(int percentage)

{

if(percentage<0)

{

cout<<"Invalid percentage";

}

else

{

salary=salary+((float)percentage/100)*salary;

}

}

};

int main()

{

int percentage;

Employee e1("Satur",1000);

cout<<"Employee details are:";

cout<<e1.getName();

cout<<e1.getSalary();

cout<<"Enter the percentage raise";

cin>>percentage;

e1.raiseSalary(percentage);

cout<<"Raise in salary:";

cout<<e1.getSalary();

return 0;

}

You might be interested in
Changing the configuration of a database falls under which category of databaseâ administration?
harkovskaia [24]
Changing the configuration of a database falls under which category of databaseâ administration?

d. operation
8 0
3 years ago
Which of the following topics is too broad for a 10-minute speech? A. classes offered in interior design B. the history of moder
aksik [14]
I would say it is <span> B. the history of modern interior design 
Because this subject stretches pretty far into history</span>
3 0
3 years ago
Read 2 more answers
Netflix suggestions ?
hjlf

Answer:Lost in space

Explanation:It is a great space movie do not watch if your scared

3 0
3 years ago
Read 2 more answers
There is no reason to study the works of famous photographers because they will make you less creative.
weeeeeb [17]
I think it is true because you may be ‘inspired’ by a famous artist but if you’re always being inspired by others its not 100% yours / you being creative
8 0
3 years ago
Read 2 more answers
Smith, Smith, Smith, and Smith (S4) is a regional accounting firm will be moving to a new four-story building. There will two Lo
ICE Princess25 [194]

Answer:

Crosstalk, Jitter, Impulse noise.

Explanation:

Crosstalk is a network error that occurs when one pair of cable causes interference on another pair of cables thereby preventing efficient data transmission.

Jitter may also impair the accuracy of the data being transmitted across network because minute variations in amplitude, phase, and frequency always occur. The generation of a perfect carrier signal in an analog circuit is almost impossible. The signal may be affected by continuous and rapid network gains or phase changes.

Impulse noise (also referred to as spikes) is the primary source of errors in data communications.  Impulse noise can be caused by positioning a communications cable near a source of intermittent but strong electromagnetic pulses, such as an elevator motor.

Counter measures

Shielding (protecting wires by covering them with an insulating coating) is one of the best ways to prevent impulse noise, cross-talk.

Amplifiers can be used to increase signal strength since the connection would run across 4 floors.

5 0
3 years ago
Other questions:
  • JavaScript
    10·1 answer
  • What is the Default path for SYSVOL?
    14·1 answer
  • What are the advantages of businesses using Twitter ?
    12·1 answer
  • I need to write a really simple python program to solve this issue. I have most of the program written but, when I run the secon
    8·1 answer
  • Consider the following code segment. int[] seq = {3, 1, 8, 4, 2, 5}; for (int k = 1; k &lt; seq.length; k++) { if (seq[k] &gt;=
    5·1 answer
  • What is required to contain warnings, after several studies that have shown that they are a suffocation risk?
    15·2 answers
  • To print a budget:________.
    9·1 answer
  • The ______________ shows that you have fully researched the topic and gives you a chance to prove your claim.
    8·1 answer
  • having your online class there's a lot of hazards and risk you may encounter while using gadget PC or Laptop whar do you usually
    14·1 answer
  • susan wrote the recursive formula for the sequence represented by the exploit formula An=3+2n. put an C net to any correct state
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!