Question: Expand the cryptic code in the getFICA method of the Employee3 class in Figure 14.20 into if else statements so that the algorithm is easier

Expand the cryptic code in the getFICA method of the Employee3 class in Figure 14.20 into “if else” statements so that the algorithm is easier to understand.

Figure 14.20

/**************** *Employee3.java * Dean & Dean * * This abstract class describes employees, and it includes

/**************** *Employee3.java * Dean & Dean * * This abstract class describes employees, and it includes * Social Security tax calculation. ***************************************************************/ public abstract class Employee3 implements Commission2 { public abstract double getPay(); private String name; private final static double FICA_TAX_RATE= 0.08; // fraction private final static double FICA_MAX = 90000; // dollars private double ytdIncome; // total year-to-date income //**************** public Employee 3 (String name) { } ***************************************** this.name = name; //* public void printPay (int date) ( } // end printPay //**** { System.out.printf("%2d %10s: %8.2f ", date, name, getPay()); ***** ******************** *******: // Postcondition: ytdIncome is increased by pay. protected double getFICA(double pay) double increment, tax; ytdIncome + pay; increment FICA_MAX- ytdIncome; } // end getFICA 3 // end class Employee3 ************** **************** This limits accessibility to classes In the subtree or in the same package. tax = FICA_TAX_RATE * (pay increment? pay: (increment > 0 ? increment : 0)); return tax;

Step by Step Solution

3.49 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The getFICA method in the Employee3 class is designed to calculate the FICA Federal Insurance Contri... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming With Java A Problem Solving Approach Questions!