20a-section-3-solutions

20a-section-3-solutions - Mehran Sahami CS 106A Handout...

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

View Full Document Right Arrow Icon
Mehran Sahami Handout #20A CS 106A October 14, 2009 Solution to Section #3 Portions of this handout by Eric Roberts and Patrick Young. 1. True/False questions a) The value of a local variable named i has no direct relationship with that of a variable named i in its caller. Answer: True b) The value of a parameter named x has no direct relationship with that of a variable named x in its caller. Answer: True 2. Tracing method execution The output of Hogwarts.java is: snitch: x = 4004, y = 1001 quaffle: x = 2003, y = 1, z = 1001 bludger: x = 1001, y = 2001, z = 2003
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 3. Random circles /* * File: RandomCircles.java * ------------------------ * This program draws a set of 10 circles with different sizes, * positions, and colors. Each circle has a randomly chosen * color, a randomly chosen radius between 5 and 50 pixels, * and a randomly chosen position on the canvas, subject to * the condition that the entire circle must fit inside the * canvas without extending past the edge. */ import acm.program.*;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

20a-section-3-solutions - Mehran Sahami CS 106A Handout...

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

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