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 instance methods to calculate the commission income, federal and social security tax withholding amounts and the amount withheld 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.
The Answer to the Question
is below this banner.
Can't find a solution anywhere?
NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?
Get the Answers Now!You will get a detailed answer to your question or assignment in the shortest time possible.
Here's the Solution to this Question
Solution in C# Programming Language
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Program
{
public class Pay //-
{
private double weekSales;
private double totalSales;
public void setweekSales(double s)
{
weekSales = s;
}
public double getTotalSales()
{
return weekSales * 0.07;
}
public double getFederalTax()
{
return (weekSales * 0.07) * 0.18;
}
public double getSecurityTax()
{
return (weekSales * 0.07) * 0.06;
}
public double getRetirement()
{
return (weekSales * 0.07) * 0.10;
}
public double getTotalPay()
{
totalSales = weekSales * 0.07;
return totalSales - (totalSales * 0.34);
}
}
public class Employee //-
{
public static void Main() //-
{
Pay Pay1 = new Pay();
double totalSales;
double federalTax;
double securityTax;
double retirement;
double totalPay;
Console.WriteLine("employee name: ");
string employeeName = Console.ReadLine();
Console.WriteLine("total weekly sales: ");
double weekSales = double.Parse(Console.ReadLine());
Pay1.setweekSales(weekSales);
totalSales = Pay1.getTotalSales();
Console.WriteLine("total amount earned: {0:C}", totalSales);
federalTax = Pay1.getFederalTax();
Console.WriteLine("cut to federal tax: {0:C}", federalTax);
securityTax = Pay1.getSecurityTax();
Console.WriteLine("cut to social security tax: {0:C}", securityTax);
retirement = Pay1.getRetirement();
Console.WriteLine("cut to retirement: {0:C}", retirement);
totalPay = Pay1.getTotalPay();
Console.WriteLine("final amount earned: {0:C}", totalPay);
}
}
}