homework3 - 15-100 HOMEWORK 3 FALL 2007Read sections...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 15-100 HOMEWORK 3 - FALL 2007Read sections 3.1-3.4 and 3.9-3.10 in your textbook and answer the following questions based on your readings and the course lectures.1. Let the variable bbe of type boolean. What value is assigned to bin each of these four assignment statements? Show your work for full credit. (a) b = !(false && (true || false));(b) b = (Math.pow(4.0, 3.0) > Math.pow(3.0, 4.0));(c) String s = new String("AUTUMN"); b = s.equals("FALL"); (d) b = ((b || !b) && (!b || b));2. Assume xand yare intvariables. For the Java code fragment below: if (x < 0) { if (x - y < 0) System.out.println("B"); else System.out.println("C"); } else System.out.println("A"); (a) Draw a flowchart to illustrate the flow of execution of the fragment. (b) Draw a graph like the one shown below, shading in the area where "A" would be output in one color, the area where "B" would be output in another color, and the area where "C" would be output in a third color. If the border of an area is included in the where "C" would be output in a third color....
View Full Document

This note was uploaded on 01/25/2010 for the course CS 15100 taught by Professor Tom during the Fall '07 term at Carnegie Mellon.

Page1 / 2

homework3 - 15-100 HOMEWORK 3 FALL 2007Read sections...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online