Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that includes a Employee class that can be used to calculate and

ID: 3676138 • Letter: W

Question

Write a program that includes a 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%. 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.

Explanation / Answer

public class Employee {

   double salesAmount;
   String nameOfEmployee;
   final int federalTax = 18, salesTax = 7, retirementCont = 10,
           socialSecTax = 6;

   /**
   * @param salesAmount
   * @param nameOfEmployee
   */
   public Employee(double salesAmount, String nameOfEmployee) {

       this.salesAmount = salesAmount;
       this.nameOfEmployee = nameOfEmployee;
   }

   /**
   * @return the salesAmount
   */
   public double getSalesAmount() {
       return salesAmount;
   }

   /**
   * @param salesAmount
   * the salesAmount to set
   */
   public void setSalesAmount(double salesAmount) {
       this.salesAmount = salesAmount;
   }

   /**
   * @return the nameOfEmployee
   */
   public String getNameOfEmployee() {
       return nameOfEmployee;
   }

   /**
   * @param nameOfEmployee
   * the nameOfEmployee to set
   */
   public void setNameOfEmployee(String nameOfEmployee) {
       this.nameOfEmployee = nameOfEmployee;
   }

   public double getFederalTax() {
       double tax = salesAmount * (federalTax / 100.00);
       return tax;

   }

   public double getSalesTax() {
       double tax = salesAmount * (salesTax / 100.00);
       return tax;

   }

   public double getRetirementContibrution() {

       double tax = salesAmount * (retirementCont / 100.00);
       return tax;

   }

   public double getSocialSecTax() {
       double tax = salesAmount * (socialSecTax / 100.00);

       return tax;

   }

   public double caliculateTakeHome() {
       // please mention logic i will update

       return 0;

   }

   /*
   * (non-Javadoc)
   *
   * @see java.lang.Object#toString()
   */
   @Override
   public String toString() {
       return "Employee [salesAmount=" + salesAmount + ", nameOfEmployee="
               + nameOfEmployee + ", getFederalTax()=" + getFederalTax()
               + ", getSalesTax()=" + getSalesTax()
               + ", getRetirementContibrution()="
               + getRetirementContibrution() + ", getSocialSecTax()="
               + getSocialSecTax() + "]";
   }

}

/**
* @author srinu
*
*/
public class TestEmployee {

   /**
   * @param args
   */
   public static void main(String[] args) {

       Employee employee = new Employee(23000, "Srinivas Palli");
       System.out.println(employee);

   }
}

OUTPUT:

Employee [salesAmount=23000.0, nameOfEmployee=Srinivas Palli, getFederalTax()=4140.0, getSalesTax()=1610.0000000000002, getRetirementContibrution()=2300.0, getSocialSecTax()=1380.0]

NOTE: please give me formula for caliculating take home

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote