Modify the given program to the given specifications

Assignment Help JAVA Programming
Reference no: EM131251112

Modify the following program to the specifications given below:

Add a new status - SingleParent - where the tax is computed as a SINGLE but with a further reduction of $5000 per child.

Add a new tax condition - if the income is greater than $249,999 for SINGLE, then add a tax of 25% on income amount above $150,000; if the income is greater than $349,999 for MARRIED, then add a tax of 35% on income amount above $200,000.

Unknown status - if the status doesn't belong to SINGLE or MARRIED or SINGLE_PARENT, then compute a 33% tax on the income.

import java.util.Scanner;
public class TaxReturn
{
/**
Constructs a TaxReturn object for a given income and
marital status, and computes the tax.
@param anIncome the taxpayer income
@param aStatus either SINGLE or MARRIED
*/
public TaxReturn(double anIncome, int aStatus)
{
income = anIncome;
status = aStatus;
}

public double getTax()
{
double tax = 0;

if (status == SINGLE)
{
if (income <= SINGLE_BRACKET1)
tax = RATE1 * income;
else if (income <= SINGLE_BRACKET2)
tax = RATE1 * SINGLE_BRACKET1
+ RATE2 * (income - SINGLE_BRACKET1);
else
tax = RATE1 * SINGLE_BRACKET1
+ RATE2 * (SINGLE_BRACKET2 - SINGLE_BRACKET1)
+ RATE3 * (income - SINGLE_BRACKET2);
}
else
{
if (income <= MARRIED_BRACKET1)
tax = RATE1 * income;
else if (income <= MARRIED_BRACKET2)
tax = RATE1 * MARRIED_BRACKET1
+ RATE2 * (income - MARRIED_BRACKET1);
else
tax = RATE1 * MARRIED_BRACKET1
+ RATE2 * (MARRIED_BRACKET2 - MARRIED_BRACKET1)
+ RATE3 * (income - MARRIED_BRACKET2);
}
return tax;
}

public static final int SINGLE = 1;
public static final int MARRIED = 2;
private static final double RATE1 = 0.15;
private static final double RATE2 = 0.28;
private static final double RATE3 = 0.31;
private static final double SINGLE_BRACKET1 = 21450;
private static final double SINGLE_BRACKET2 = 51900;
private static final double MARRIED_BRACKET1 = 35800;
private static final double MARRIED_BRACKET2 = 86500;
private double income;
private int status;

public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Please enter your income: ");
double income = in.nextDouble();

System.out.print("Enter S (single) or M (married): ");
String input = in.next();
int status = 0;

if (input.equalsIgnoreCase("S"))
status = TaxReturn.SINGLE;
else if (input.equalsIgnoreCase("M"))
status = TaxReturn.MARRIED;
else
{
System.out.println("Bad input.");
return;
}
TaxReturn aTaxReturn = new TaxReturn(income, status);
System.out.println("The tax is " + aTaxReturn.getTax());
}
}

Reference no: EM131251112

Questions Cloud

Bap22 management accounting : The value chain provides a useful framework for examining the areas where costs are incurred within a business. The value chain is a set of linked processes or activities that begins with acquiring resources and ends with providing goods and services..
Describe financial statements roles in evaluating company : Locate and submit the following financial statements for your chosen company for the last three years: - Describe the financial statements' roles in evaluating company performance. Briefly and in general terms:
Find a photograph of college students circa : Find a photograph of college students circa 1960-1969 and describe with significant detail what you see. Pay attention to dress, hair styles, gestures, books and compare it to a photograph of students in a college setting 2015/16. Be sure to descr..
Development of a problem statement : In the development of a problem statement, what are some components you consider important as you identify the real causes of a problem?
Modify the given program to the given specifications : Modify the following program to the specifications given below: Add a new status - SingleParent - where the tax is computed as a SINGLE but with a further reduction of $5000 per child.
Development of money and banking systems : Development of money and banking systems Political organization and parties?Taxation?Laws, regulations, justice and court systems Militaries. Describe the impacts of the technology on your home region
Discuss the effects of your own enculturation or group : Discuss the effects of your own enculturation or group identification that may have influenced your biases. Discuss whether or not your thinking about the topic has changed after playing the "Believing Game," even if your position on the issue has ..
Own idea for an innovation along with a model : During Phase 1, each individual will submit their own idea for an innovation along with a model they find useful for evaluating its merits. Each team member is responsible for completing research on various models.
Determine ending inventory and cost of goods sold : DETERMINE ENDING INVENTORY AND COST OF GOODS SOLD USING THE RETAIL METHOD.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd