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
I need help please!!?
tensa zangetsu [6.8K]

Answer: C. Shaking hands after a game/contest

Have a nice day!

5 0
3 years ago
Read 2 more answers
what is the software that controls the storage, retrieval and manipulation of database stored in a database
irga5000 [103]
A database management system (DBMS) is the software which controls the storage, retrieval, deletion, security, and integrity of data within a database.
5 0
3 years ago
Which setting on a profile makes a tab NOT accessible in the All App Launcher or visible in any app, but still allows a user to
Levart [38]

Answer:

freezer

Explanation:

you can freeze your application and it won't show on your launcher till you unfreeze it

5 0
3 years ago
The Hydrosphere contains (4 points)
cricket20 [7]
<span>exothermic reaction

hope it helepd</span>
5 0
4 years ago
Which requires large computer memory?
Sav [38]

Answer:

Imaging , Graphics and voice..... requires large computer memory.

Explanation:

5 0
3 years ago
Other questions:
  • Answer the following questions which are based on the study "Patients' Engagement with Sweet Talk." Submit your answers to the e
    9·1 answer
  • The idea of supply and demand is based on the development of
    10·2 answers
  • Which type of development metrics does Instagram most improve when it releases an update in the App Store to fix errors its cust
    15·1 answer
  • B. Does “refactoring” mean that you modify the entire design iteratively? If not, what does it mean?
    7·1 answer
  • DigitalHealth Electronics Inc. is a company that builds diagnostic devices. It was the first company to develop a compact MRI sc
    13·1 answer
  • Assignment 1 is to write a program that will write the lyrics to "X number of beers on the wall". Use only the main method. Prom
    11·1 answer
  • What are the basic features of Usenet group
    15·1 answer
  • What is a navigation bar?
    7·1 answer
  • Write long answer to the following question. a. Define microcomputer. Explain the types of microcomputers in detail.​
    5·2 answers
  • Help ASAP
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!