Boolean Expressions

This chapter introduces relational and logical operators. It also discusses the use of these operators to write Boolean expressions.

11. Tax Bracket


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; public 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.