Tax Bracket

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

Answer:

How heavy is the boxer? 140
In range!

The and-operator gives true because both sides are true:

weight >= 136 && weight <= 147
 140   >= 136 &&   140  <= 147
 ------------      -----------
    true               true
       -----------------
             true

Tax Bracket

An unmarried taxpayer in the US with an income of $24,000 up to $58,150 (inclusive) falls into the 28% "tax bracket." Here is a program that tests if a taxpayer falls into this bracket.

// IRS Weigh-in
//
// Income between $24000 and $58150 inclusive
//
import java.util.Scanner;
class TaxGouge
{
  public static void main (String[] args) 
  { 
    Scanner scan = new Scanner( System.in );
    int income; 

    // get the income
    System.out.println("What is your income?");
    income = scan.nextInt(); 

    // check that the income is within range for the 28% bracket
    if (  )
      System.out.println("In the 28% bracket." );
    else
      System.out.println("Time for a tax audit!" );
  }
}

QUESTION 11:

Fill in the blank to test if the income is within this tax bracket.