Comp 151 Project 6:
Due Monday April 11th at 11:59pm (you have two weeks and you will need the time)
Making a complete object work with others.
Summary: you have been added to
a group doing programming and before letting you touch production code,
they want to see if you are capable by having you complete an
unfinished tech demo for them. The UML is laid out for you, most of the
code is done, but you need to write one more class.
first you need to download the project starter zip.
This file contains an eclipse project with three of the four classes
that are needed to write the program; you will need to write the forth
class: the Sprite class. See the UML diagram below.
The Lab6.java, DrawingPanel.java and Picture.java are provided for you.
You will need to implement the Sprite class according to the UML
diagram above in order to make my code work.
Most of the methods are fairly self explanitory, but I'll add a bit of direction about what I'm looking for below.
- The first sprite constructor will take a Picture as a parameter
- use that parameter to initialize the myPicture instance variable.
- randomly (as in use the Random object) assign a value of 0-75 for both xPos and yPos.
- The copy constructor should be a standard copy constructor.
- the toString is a standard toString, you need to mention the name
of the class, and the name an value of each instance variable
- equals should check this sprite and the other sprite for content equality
- getPicture is an accessor for myPicture
- setNewPos should use its parameters to change the xPos and yPos instance variables
- getX is an accessor for xPos
- getY is an accessor for yPos
When your code is complete, you will see a window that looks something
like this when you first run your program (there will be minor
differences from student to student) The Print button will print out
data about the first sprite to the command line. The Duplicate Sprite
button will create a new sprite on the screen.
To help you get in the habit of good program writing, I am imposing the
following additional restrictions on your program.
- You must
comment your code. We are starting to get to the point
where you are writing longer programs and doing more on your own. you
will need to start commenting your code so that both you and I know
what you are trying to do. To this end credit in the assignment will be
reservedfor grading your comments.
- Add a readme.txt file as a
text file in your submission. Your readme file should contain
- your name
- a brief (one paragraph) description of
you implemented the project,
- anything that is left undone in the
again zip up your project folder and submit it to me by email. Make sure that your submitted zip file
contains your first initial and last name as part of the zip file name. This means you will have to rename either your folder or the zip file.