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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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