Wednesday
March 29, 2017

Post a New Question

Posted by on .

write a program in C# that calculates and prints the take home pay for a commissioned sales employee. allow the user to enter values for the name of the employee and the sales amount for the week. employee receives 7% of the total sales. federal tax rate is 18%. retirement contribution is 10%. social security is 6%. use appropriate constants. design an object oriented solution and write constructors. include at least one mutator and one accessor mathod; provide properties for the other instance variables.

  • programming - ,

    There can be many ways to approach the problem, but it would be obvious that you'll need to create a class.

    The instance variables will contain the employee's name, and the weekly sales.

    The constants (7%, 18%, 10%, 6%, etc.) could be a static constant, since every employee uses the same values. By setting it as a static constant, you will avoid multiple copies when new instances are created, also it is easier to edit if these rates change.

    A mutator is a method that modifies the value of an instance variable, say the weekly sales.
    An accessor is method that returns the value of a given instance variable.

    In general, you would have a method for data entry for the employee, and all data would be written through the constructor. Instance variables should be private, so any access should be done through an accessor.

    You'd have another method to print the calculations or the "pay slip", whichever way you prefer.

    If you come up with a pseudocode, feel free to post it for comments. However, we do not do the work for you, for the reason that solving the problem is a cognitive process that helps you learn and retain what you learned, which you'll need for exams and more important, when you eventually get a job in the field.

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question