Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Support your message with writing techniques

Answered: 1 week ago