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
A(n) ____________________ can improve system performance when two devices have different data transfer rates, as when copying mu
defon

Hello there

the answer to the question is

<u><em>Buffer</em></u>

hope this helps

Best Regards Queen Z

8 0
3 years ago
Binary is used to store what on a computer?<br> •Data<br> •Dates<br> •Address
solmaris [256]

Answer:

Data................

5 0
3 years ago
Read 2 more answers
8.17 Lab: Strings of a Frequency Write a program that reads whitespace delimited strings (words) and an integer (freq). Then, th
gavmur [86]

Answer:

def occurencesOfWords(words,freq):

  frequency_dictionary={}

  matched_frequency_words=[]

  for i in range(len(words)):

      counter=1

      a=words[i].lower()

      for j in range(len(words)):

          if(i==j):

              continue

          b=words[j].lower()

          if(a==b):

              counter+=1

      frequency_dictionary[words[i]]=counter

  for key in frequency_dictionary:

      if(frequency_dictionary[key]==freq):

          matched_frequency_words.append(key)

  return matched_frequency_words

if __name__=='__main__':

  user_input=input()

  freq=int(input())

  words=user_input.split(" ");

  required_words=occurencesOfWords(words,freq)

  for s in required_words:

      print(s)

Explanation:

  • Inside the occurencesOfWords function, initialize a frequency_dictionary that is used to store the string and the frequency of that specific string .
  • matched_frequency_words is an array that is used to store each string whose frequency matches with the provided frequency
  • Run a nested for loop up to the length of words and inside the nested for loop, skip the iteration if both variables i and j are equal as both strings are at same index.
  • Increment the counter variable, if two string are equal.
  • Loop through the frequency_dictionary to get the matching frequency strings .
  • Finally test the program inside the main function.
5 0
3 years ago
A built in mathematical formulae used to perform calculation _______​
zubka84 [21]

Answer:

o enter an Excel formula into a cell, you start with an equal (=) sign. Excel then knows that the expression that follows should be interpreted as a calculation, not text. After the equal sign, you enter the formula. For example, you can find the sum of the numbers in cells C2 and C3 by using the formula =C2+C3.

Explanation:

hope that helps you

6 0
3 years ago
I'm looking for a new laptop for school. Which laptop would be the best. Right now I have a chromebook and it is broken. 
Y_Kistochka [10]
Any HP laptop would be good! What is your price range?
Also, if it is for school, have you considered getting an iPad? It is great for taking notes and looking stuff up and being portable. My friends currently use it
3 0
3 years ago
Read 2 more answers
Other questions:
  • What company or individual is responsible for developing the linux operating system?
    7·1 answer
  • What need did anti lock brakes address?
    10·1 answer
  • The quality of lacking a pattern or organization so that result are unpredictable is also known as?
    7·1 answer
  • Select the correct answer.
    6·2 answers
  • Brainliest for whoever adds me on snap<br> gianavaughn007
    15·2 answers
  • What is the useful chart used for comparing values over categories?​
    8·1 answer
  • 6-1) (Math: pentagonal numbers) A pentagonal number is defined as n(3n–1)/2 for n = 1, 2, . . ., and so on. Therefore, the first
    10·1 answer
  • is a security design principle to direct the selection of control layers for an organization's computing enclave to ensure its r
    6·1 answer
  • 3.There are 3 arrays that hold related data at each position (parallel). The first array holds product codes. The second holds t
    7·1 answer
  • Ntering a system call involves changing from kernel mode to user mode.<br><br> a. true <br> b. false
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!