Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9255067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:37:45+00:00 2026-06-18T11:37:45+00:00

I have just finished a Java test at university and I know that I

  • 0

I have just finished a Java test at university and I know that I have answered a particular question wrong and would just like some help / clarification please?

The question was as follows:

implement a method that takes someones income and works out the tax.
If that person earns less than 7500 then tax = 0.
If that person earns between 7501 and 45000 then tax = 20%, less the 7500, which is tax free.
Finally, if that person earns above 45001 then tax = 40%, less the income in the 20% bracket, and then less the 7500 which is tax free.

As time was running short, I just did a basic if else statement showing income and tax brackets, example below.

public static double incomeTax(double income){

    if(income <= 7500){
           income = income * 0;
       }
     else if(income >= 7501 && income <= 45000){
           income = income * 0.8;
       }
     else(income >= 45001){
           income = income * 0.6;
       }
     return income;
} 

I know that the code is not correct, no where near, but as it was coming to the end of the test I gave it a go in a hope just to get a mark for the if else statements.

I would really appreciate any help here.

Thank you.

After great feedback, this is what I came back with (with a LOT of help!!:] )…

import java.util.Scanner;

public class TaxableIncome
{
public static void main(String[] args){
    netIncome();
}

public static double netIncome() {
    double income = 0;

    Scanner in = new Scanner(System.in);

    System.out.print("Enter income: ");
    income = in.nextDouble();
    System.out.println();

    double tax1 = 0;
    double tax2 = 0;
    double totalTax = tax1 + tax2;

    // high income bracket
    if (income > 45000) {
        double part1 = income - 45000; // part = income - 45000
        tax1 += part1 * 0.4; // tax = tax + part * 0.4
        System.out.println("High Tax Band - Greater than 45000: " + tax1);
    }

    // medium income bracket
    if (income >  7500) {
        double part2 = income - 7500;
        tax2 += part2 * 0.2;
        System.out.println("Medium Tax Band - Greater than 7500: " + tax2);
    }

    System.out.println("Total Tax = " + (tax1 + tax2));

    // tax for low income is zero, we don't need to compute anything.

    return totalTax;
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:37:46+00:00Added an answer on June 18, 2026 at 11:37 am

    A simple answer would be as this:

    public static double netIncome(double income) {
    
      double tax = 0;
    
      // high income bracket
      if (income > 45000) {
        double part = income - 45000;
        tax += part * 0.4;
        income = 45000;
      }
    
      // medium income bracket
      if (income >  7500) {
        double part = income - 7500;
        tax += part * 0.2;
      }
    
      // tax for low income is zero, we don't need to compute anything.
    
      return tax;
    }
    

    This way you calculate the tax for each tax bracket and sum them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just finished reading the HTML5 Developer's Cookbook and have a question. I've read
I've just finished merging two branches that have been separated for a long time,
I have an integration test, in java, of a facade that does a few
I have just finished up my first book on Java training and I think
I have a Java program that reads some text from a file, line by
I am relativity new to multithreading in Java, and I would like to know
I have just a quick question: Are files created before they are finished, or
i'm just learning java, and i meet some problems. Here we have simple factory
I've just finished reading 'Java for Dummies' and have begun to create a simple
I have just finished creating an API where the requests from the API are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.