Question: public class IncomeTax { public static final double RATE1 = 0.15; public static final double RATE2 = 0.30; public static final double RATE1_SINGLE_LIMIT = 42000;
public class IncomeTax { public static final double RATE1 = 0.15; public static final double RATE2 = 0.30; public static final double RATE1_SINGLE_LIMIT = 42000; public static final double RATE1_MARRIED_LIMIT = 76000; private double income; private String status; public IncomeTax(double incomeAmount, String relationshipStatus){ // construct the internal variables } public double getTax(){ double tax1 = 0.0; double tax2 = 0.0; // check the relationship status if they are single // check if the income is at or below the single rate limit // create the return amount based on rate one // if the income is greater than the limit // get the return for rate1 on the rate1 single limit // get the return for the remaining income on rate2 after removing the limit // check the relationship status if they are married // check if the income is at or below the married rate limit // create the return amount based on rate one // if the income is greater than the limit // get the return for rate1 on the rate1 married limit // get the return for the remaining income on rate2 after removing the limit // the relationship status is not acceptable // return the combined amounts for rate1 and rate2 } public static void main(String [] argv){ IncomeTax tax1 = new IncomeTax(80000, "single"); IncomeTax tax2 = new IncomeTax(20000, "single"); IncomeTax tax3 = new IncomeTax(80000, "married"); IncomeTax tax4 = new IncomeTax(20000, "married"); IncomeTax tax5 = new IncomeTax(20000, "N/A"); // create IncomeTax array and fill it with the 5 items // use a for loop to cycle through the tax items and getTax for each tax item } } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
