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
Create a medical report for Wellness Hospital. Mention the hospital name as the heading and the report name as the subheading. T
IrinaK [193]

Some things to consider when preparing a medical report are:

  1. Informed consent of the patient
  2. Physical examinations of the patient
  3. Background information
  4. Obtained specimens
  5. Medical history, etc.

<h3>What is a Medical Report?</h3>

This refers to the very detailed report that contains an account of a person's full clinical history.

Therefore, a sample medical report is given below:

  • Name of Hospital: Mellview Hospital
  • Address: 27, Hemingway Close, London
  • Gender: Male
  • Name: Oscar Pedrozo
  • HIV test, Malaria test, High Blood Pressure, etc.

Read more about medical reports here:

brainly.com/question/21819443

#SPJ1

5 0
2 years ago
What is seven times seven divided by 49
Travka [436]

The answer is really simple. 7 x 7 = 49. 49/49 is 1. I hope this helps

6 0
3 years ago
Read 2 more answers
Write the definition of a function typing_speed, that receives two parameters. The first is the number of words that a person ha
Lera25 [3.4K]

Answer:

The definition of function is as follows:

def typing_speed(number_of_words,Time_Interval):

number_of_words>=0  

Time_Interval>0

speed=float(60*number_of_words/Time_Interval)

return speed

Explanation:

Above function is defined step-by-step as follows:

        def typing_speed(number_of_words,Time_Interval):

  • A function named typing speed has two arguments, num_of_words and Time_Interval.

                             number_of_words>=0  

                             Time_Interval>0

  • The variable number_of_words is the number of words entered that a person enters, they must be greater than or equal to 0. Where as Time_Interval is the variable for counting the time span in seconds, it must be greater than 0.

                    speed=float(60*number_of_words/Time_Interval)

                    return speed

  • For determining result firstly the seconds are converted int minutes by multiplying with 60 and number_of_words is divided with Time_Interval in order to get words per minute. The return value will give speed which has data type float.

4 0
3 years ago
Write a method maxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the method in a pr
klio [65]

Answer:

See the code snippet below

Explanation:

import java.util.Scanner;

public class LabProgram{

     public static void main(String[] args){

          Scanner scan = new Scanner(System.in);

          System.out.println("Please enter first number: ");

          int firstNumber = scan.nextInt();

          System.out.println("Please enter second number: ");

          int secondNumber = scan.nextInt();

          maxMagnitude(firstNumber, secondNumber);

}

     public static int maxMagnitude(int firstValue, secondValue){

         System.out.println(Math.max(firstValue, secondValue));

}

}

6 0
3 years ago
After a system is released and the user base grows, the demands on the development and support team will ______.
otez555 [7]

After a system is released and the user base grows, the demands on the development and support team will increase.

The development team can scale vertically by adding new people to the team.

6 0
3 years ago
Other questions:
  • Free points! your welcome
    9·2 answers
  • Elizabeth works for a local restaurant at the end of her shift she read she’s required to write in the time that she arrived in
    14·1 answer
  • Can someone help me with this
    10·1 answer
  • which program monitors the computer by looking for known trouble makers as well as suspicious behavior​
    11·1 answer
  • Assume that the message M has to be transmitted. Given the generator function G for the CRC scheme, calculate CRC. What will be
    15·1 answer
  • Brenda has created a Microsoft Excel spreadsheet which has 1000's of cells of data. She is looking for specific information in t
    11·1 answer
  • A(n) ________ attempts to slow down or stop a computer system or network by sending repetitive requests for information.
    6·1 answer
  • How to make text icome one word at a timen filmora
    10·1 answer
  • Good day Statistical Methods tutor , I would like to know the formula for calculating the percentage of stockouts for the given
    14·1 answer
  • Select the function of keypunches that were used as one of the earliest input devices. A. It was used to control the cursor on t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!