SHEMIAH Brathwaite cs110 howework

# SHEMIAH Brathwaite - SHEMIAH Brathwaite CS110 Home Work3(4.1 The program still prints the lowest value Because the two equal values produces a

This preview shows pages 1–3. Sign up to view the full content.

SHEMIAH Brathwaite CS110 Home Work3 (4.1) The program still prints the lowest value. Because the two equal values produces a false result. If two values are equal, and lower than the third value, then one of the two lower but equal values is printed. (4.2) if (total == MAX) { if (total < sum) System.out.println (“total == MAX and is < sum.”); } else System.out.println (“total is not equal to MAX”); (3) if (length = MIN_LENGTH) System.out.println ("The length is minimal."); Equal (=) is used in place of the double equal (==). So, it will not compiled. 5.1. (4.4) int num = 87, max = 25; if (num >= max*2) System.out.println ("apple"); System.out.println ("orange"); System.out.println ("pear"); Print: apple orange pear The second println statement is not indented. 5.2. (4.5) int limit = 100, num1 = 15, num2 = 40; if (limit <= limit) { if (num1 == num2) System.out.println ("lemon"); System.out.println ("lime"); } System.out.println ("grape"); Print: lime grape

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
(4.6) String in lexicographic order:
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/07/2010 for the course CS 120 taught by Professor Peter during the Spring '10 term at Mass Colleges.

### Page1 / 5

SHEMIAH Brathwaite - SHEMIAH Brathwaite CS110 Home Work3(4.1 The program still prints the lowest value Because the two equal values produces a

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online