Write a main function to test the class employee

Assignment Help C/C++ Programming
Reference no: EM13782596

Using C++ program language:

Define an Employee class. Add the following private date members to the class: string status, int dependents. Status represents the marital status of the employee and should be set to either "m" or "s". Add mutator/set and accessor/get methods for each of the new private data members. You must also revise the class constructors and the print method in the class to display all private data members.

Include a public method "taxDeduction()" that should inspect the weeklyPay of the employee object and then based on the number of dependents and marital status return the tax deduction from a weekly pay based on the following table

Dependents

M % tax deduction

S %tax deduction

Less than or equal to 2

20%

25%

3

15%

20%

4

10%

15%

Greater than or equal to 5

8%

10%

Write a main function to test the class Employee. Create an object of the type Employee and call it myE then print the object and display the tax deduction from the weekly pay.

Add the following to your main function:

Create two Employee pointer variables ptr1 and ptr2 and set them to NULL.

Make ptr1 point to the Employee myE created in part 3.

Dynamically allocated an Employee object and make ptr2 point to it.

Use the two pointers to call the print method of the object they point to.

Use ptr1 to change the value of the "dependents" of the myE

Now make ptr2 point to myE. How many pointers are pointing to the Employee object myE? What happened to the dynamically created object that ptr2 was pointing to? What were you supposed to do before making ptr2 point to myE?

Reference no: EM13782596

Questions Cloud

Metamorphosis and handling the undead issues : What connections do you see between Metamorphosis and Handling the Undead? What are some themes and/or messages that they have in common?
Examine theories related to conflict : Examine theories related to conflict. Describe the conflict process.
Show how moderate inflation can be a good thing : What is hyperinflation? What causes hyperinflation - show how moderate inflation can be a good thing?
Discuss several of those concerns : In a study conducted by the U.S. Justice Department, victims expressed many concerns about their participation in the process. Discuss several of those concerns
Write a main function to test the class employee : Define an Employee class. Add the following private date members to the class: string status, int dependents. Status represents the marital status of the employee and should be set to either "m" or "s".
Article short-term goals and long-term goals : From the article "Creating the Future," clearly summarize the article's short-term goals and long-term goals.
What evidence do you do look at as the investigator : What would you say happened to this victim? What are some options for this scenario? What evidence do you do look at as the investigator
Person metaphysics influence that person axiology : Does a person's metaphysics influence that person's axiology and, if so, how Does the law of karma, which ensures that good will be rewarded the evil punished (if not in this lifetime then in another), seem fair to you? Why, or why not?
Identify who would testify in this scenario : Identify who would testify in this scenario as an expert witness. Identify who would testify in this scenario as a lay witness, and explain why

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a complete c++ program that read

Write a complete C++ program that read in from the key board a string and converts all letters in the string to upper cases. You are not allowed to use topper function.

  Write a program to find the max value

Write a program to find the max value in an unsigned char array[100].

  Compare and contrast the mode operators ios

Compare and contrast the mode operators ios::in, ios::app, and ios::out. Provide a C++ code segment that illustrates the use of these mode operators.

  Program that reads in the average monthly

Write a program that reads in the average monthly rainfall for a city for each month of the year and then reads in the actual monthly rainfall for each of the previous 12 months. The program then prints out a nicely formatted table showing the rainfa..

  Reverse the order of the characters in the string

Write a program which will perform the following " using MARS - Assembly language"

  Your project must use and demonstrate understanding

Your project must use and demonstrate understanding of:a. Variables b. Loops c. Decision statements d. File I/O e. Screen output f. Keyboard input g. Functions h. Arrays i. Searching and sorting j. Classes k. Objects l. Methods

  Objectivein this assignment you read a list of employees

objectivein this assignment you read a list of employees from a csv file and convert them into corresponding objects.

  Numbers until the user wants and in the end display

Write a C program to enter the numbers until the user wants and in the end display the product of numbers entered by the user. The program should terminate once the user enters the character 'n' and continue computing product if user enters 'y'

  What is the best way to output the result of a function

What is the best way to output the result of a function?

  Write a literal representing the long integer

Write a literal representing the long integer value twelve billion.

  Sockets for this problem you will implement a client-server

sockets for this problem you will implement a client-server version of the rock-paper-scissors-lizard-spock game which

  Recognition of the problem by the hsbc

What problem did the HSBC face in this case? What people, technology, and the organization factors were responsible for problem? Did HSBC management correctly recognize the problem?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd