13-assignment-2

13-assignment-2 - Mehran Sahami CS 106A Handout #13 October...

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

View Full Document Right Arrow Icon
Mehran Sahami Handout #13 CS 106A October 7, 2011 Assignment #2: Simple Java Programs Due: 3:15pm on Monday, October 17th Your Early Assignment Help (YEAH) hours: 7:30pm-9:30pm, Monday, October 10th in Braun Lecture Hall (in Mudd Chemistry Bldg.) Portions based on a handout by Eric Roberts Your job in this assignment is to write programs to solve each of these six problems. You should start by downloading the starter project for Assignment #2 from the CS106A assignment page (go to the CS106A web site and click the Assignments link). The starter project will provide java files for you to write your programs in. 1. Write a GraphicsProgram subclass that draws a pyramid consisting of bricks arranged in horizontal rows, so that the number of bricks in each row decreases by one as you move up the pyramid, as shown in the following sample run: The pyramid should be centered at the bottom of the window and should use constants for the following parameters: BRICK_WIDTH The width of each brick (30 pixels) BRICK_HEIGHT The height of each brick (12 pixels) BRICKS_IN_BASE The number of bricks in the base (14) The numbers in parentheses show the values for this diagram, but you must be able to change those values in your program.
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 – 2. Suppose that you’ve been hired to produce a program that draws an image of an archery target—or, if you prefer commercial applications, a logo for a national department store chain—that looks like this: This figure is simply three GOval objects, two red and one white, drawn in the correct order. The outer circle should have a radius of one inch (72 pixels), the white circle
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.

This note was uploaded on 02/09/2012 for the course CS 106A taught by Professor Sahami,m during the Fall '08 term at Stanford.

Page1 / 5

13-assignment-2 - Mehran Sahami CS 106A Handout #13 October...

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