Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C#: Write a program that includes an Employee class that can be used to calculate and print the take-home pay for a commissioned sales employee.

C#: Write a program that includes an Employee class that can be used to calculate and print the take-home pay for a commissioned sales employee. All employees receive 7% of the total sales. Federal tax rate is 18%. Retirement contribution is 10%. Social Security tax rate is 6%. Write insurance methods to calculate the commission income, federal, and social security tax withholding amounts and the amount for retirement. Use appropriate constants, design an object-oriented solution, and write constructors. Include at least one mutator and one accessor method; provide properties for the other instance variables. Create a second class to test your design. Allow the user to enter values for the name of the employee and the sales amount for the week in the second class to collect information from the user via WriteLine and ReadLine statements and return this data back to the main program method.

I wrote the program (and will have it below) but I need to answer these things. I am sure I am over thinking this but I am having trouble with it so here is what I need to do:

User Story (1 or more): Form: As a {role} I want to {goal/desire} so that {benefit}

Algorithms (calculations in your programs) Program data needs (what data will you have to store and the type): Pseudo Code (your steps to get to the program outcome in English): Class Diagrams:

Here is my code:

class Employee { // Decalare varaiables private int employeeNumber; private string name; private string hiredate; private int monthlySalary; private string description; private string department; private decimal weeklySales;

public int EmployeeNumber { get {return employeeNumber;} set {employeeNumber = value;} }

public string Name { get {return name;} set {name = value;} }

public string Hiredate { get {return hiredate;} set {hiredate = value;} }

public int MonthlySalary { get {return monthlySalary;} set {monthlySalary = value;} } public string Department { get {return department;} set {department = value;} } public string Description { get {return description;} set {description = value;} } public decimal WeeklySales { get { return weeklySales; } }

} }

Second class:

// class to test Employee class public class TestEmployee {

public static void Main(String[] args) { // set weekly sales int weeklySales = 0;

// Get the employees' name string empName; Console.Write("Enter the employees' name: "); empName = Console.ReadLine(); Console.Write("What are your weekly sales in dollars? "); String input = Console.ReadLine(); weeklySales = Convert.ToInt32(input);

// The taxes and take aways Double grossPay = (weeklySales * .07); Double fedTax = (grossPay * .18); Double retirement = (grossPay * .10); Double socSecurity = (grossPay * .06); Double totDeductions = (socSecurity + retirement + fedTax); Double takeHomePay = (grossPay - totDeductions);

Console.Write(" Hello {0} Your: Weekly Sales amount is: ${1} Gross Pay is: ${2}" + " Fed Tax is: ${3} Retirement is: ${4} Social Security is: ${5}" + " Total Deductions is: ${6} Making your take home pay: ${7}" , empName, weeklySales, grossPay, fedTax, retirement, socSecurity, totDeductions, takeHomePay);

// Keep the window open Console.ReadKey(); } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

1. How might volunteering help the employer and the employee?

Answered: 1 week ago