Please remember that homework must be handed in on time. No late homework will be accepted.
Review the suggested readings from chapter 5 of your textbook and answer the following questions based on your textbook and the course lecture material.
if (x < 0) { if (x - y < 0) System.out.println("B"); else System.out.println("C"); } else System.out.println("A");
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 shaded area, draw the border as a solid line. Otherwise, draw the border as a dashed line.
y ^ | | | | x -------------------------> | | | | |
if ( (age ____ 25) ____ (veteran ____ true) ) System.out.println("DISCOUNT APPLIES"); else System.out.println("NO DISCOUNT");
if (___________________________) System.out.println("A"); else if (_____________________________) System.out.println("B"); else if (_____________________________) System.out.println("R"); else if (_____________________________) System.out.println("C"); else System.out.println("D");
if (x > 0) if (y > 0) z = 5; else z = 3;
Keep in mind that the user might not enter a genre using all uppercase letters. For example, if the user enters "Pop" or "pop", you should treat that as "POP". Otherwise, the genre must match exactly. For example, "MODERN COUNTRY" and "RAPPING" are not matches.
Remember: You should try to write this by hand without using a computer to test your code. On a written exam, you will have to write Java code without the help of a computer.