{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CSE8A_HW2 - Homework 2 Shapes Backgrounds Due 5:00pm Friday...

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

View Full Document Right Arrow Icon
Homework 2: Shapes & Backgrounds Due: 5:00pm, Friday, January 21st Set Up Open your home directory (double click on your cs8wXX icon; 2 nd icon from the top) and create a new directory in your home directory called hw2 (all lowercase). Copy the folder bookClasses from your Desktop into the hw2 directory. o Right click on bookClasses > Copy > Right click on hw2 folder > Paste Into Folder When you work in Dr. Java be sure you are editing files in the hw2/bookClasses directory. Problems 1. Shapes This program requires you create a program called CreateShapes.java and modify the existing Turtle.java file in order to draw four copies of the same shape (e.g., octagon, star, or some weird shape you create, see below for restrictions) but with varying sizes and colors so as to look something like this: But you can't do squares, it is too easy . As in the example, you are required to have all four of the shapes be the same shape, be nested within one another and have different colors. Your shape should be a closed shape and it should have at least 5 sides. To create this program you will need to do the following: Turtle.java already exists in your hw2/bookClasses directory. Open it in Dr. Java (File, Open, surf to your bookClasses folder in your hw2 directory). Modify Turtle.java by going to the bottom of the file (but above the last "}" bracket). You will add one method to Turtle.java named drawShape which takes in one integer parameter: size .
Background image of page 1

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

View Full Document Right Arrow Icon
o To be specific, you should add a method AT THE BOTTOM of the Turtle.java file that looks like this: /* * Name: drawShape * Purpose: Briefly describe the purpose of this class or method * Parameters: List all parameters and their types and what they represent. * If no parameters, just state None. * Return: Specify the return type and what it represents.
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.

{[ snackBarMessage ]}