Comp 101 Lab7: Lots of stuff running around the screen
Due Monday May 5th at 11:59pm.
Introduction:
Well
here it is, the last lab of the semester. It's the time when all of you
are busy working on projects in every class so this lab will be a
little less code intensive than some of your others. It should help you
become more confident in your skills as programmers.
Objectives:
- Use ArrayLists
- use a generalized for loop. (for each loop)
- Develop confidence in your abilities
Assignment Specifications
Expand your lab6 to have 5 of your complex shapes following one another around the screen.
- In your DrawingPanel class,
- change your complex shape instance variable to an ArrayList of Complex Shapes.
- change your Darawing Panel constructor to take an ArrayList of Complex shapes as a parameter
- in
your paintComponent method change your _myShape.draw(g) call to a
for-each loop which calls draw on each of the complex shapes in the new
ArrayList of Complex Shapes instance variable.
- In your Lab6 class
- replace the line which creates the complex shape with several lines of code
- first create an ArrayList of Complex shapes
- then in a loop add 5 new complex shapes to that array list (make sure that each shape starts at a different spot on the screen)
- In your ComplexShape class make sure that you have a constructor that takes two int parameters to specify the starting x and y positions on the screen
And thats all you need, now we've taken a simple lab and made a little more interesting
Submitting
Include a readme file with
- Your name
- How do I run your program? What should I expect to see in it.
- What did you do and why? did you add any more methods? what were they?
- Any errors or incomplete parts of your program
Then zip up your lab6 directory and submit as usual. But!!! even though
most of you will still be working in a folder called Lab6, make sure
that the zip file that you submit has the word Lab7 in its name so I
know when assignment this is.