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 c++ program to calculate the gpa of 5 courses

Write a C++ program to calculate the Gpa of 5 courses. When users enter the grades and credits of the courses from the keyboard

  The two-dimensional array

1. Given the two-dimensional array declared by the following statement int myArray[4][3] = {{2,4,6},{1,8,10},{3,5,7},[9,11,13}}; what is the value of myArray[1][2]

  Prepare a program to print out a multiplication table

Create a program using C++ that prints out a multiplication table up to a specific limit. The code should prompt the user for the limit and then print out the table.

  Create a program for a company named retail-martprompt the

create a program for a company named retail-martprompt the user to enter an item name one word only a quantity and a

  What output is produced by the following program

What output is produced by the following program?

  Write a function int frequency

Write a function int frequency (int theArray [ ], int n, int x) that counts the number of times the item x appears among the first n elements of theArray and returns that count as the frequency of x in theArray. Use integers for everything!

  Write a c program to do the followingwrite a program that

write a c program to do the followingwrite a program that reads a data file of floating numbers into an array and

  Program that use classes game-arena-robot and player

Your assignment is to complete this C++ program skeleton to produce a program that implements the described behavior. (We've indicated where you have work to do by comments containing the text TODO;

  Define a class named payment that contains an instance

Define a class named Payment that contains an instance variable of type double that stores the amount of the payment and appropriate accessor and mutator methods.

  Calculates the factorial value of its single int parameter

Write a method called fact that recursively calculates the factorial value of its single int parameter.

  Design a fraction class

Design a fraction class. The class should have 2 data members to represent the numerator and denominator. Both of these numbers should obviously be integers. It should be able to display a fraction and include an operator for performing multiplica..

  Modify the circuit of figure by rewriting the pld program

Modify the circuit of Figure by rewriting the PLD program to address memory in locations A0000H-BFFFFH for the ROM

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