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
A single taxpayer 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.io.*; class TaxGouge { public static void main (String[] args) throws IOException { BufferedReader stdin = new BufferedReader ( new InputStreamReader( System.in ) ); String inData; int income; // get the income System.out.println("What is your income?"); inData = stdin.readLine(); income = Integer.parseInt( inData ); // check that the income is within range for the 28% bracket if ( _______________________ ) System.out.println("In the28% bracket." ); else System.out.println("Time for an audit!" ); } } |