Partner names to the left type first. Your team will work only on this person's account today. I will tell you when to switch to the second partner typing. The second partner should not be logged into any machine today.
Time to write a Fish class.
Here's how ClientFish.java works with a fish my fish...
download 1) ClientFish.java, 2) Fish_LD.class, and 3) drDaleFish.txtjavac ClientFish.java
java ClientFish < drDaleFish.txtYou'll create YOUR fish class, modify the initials in ClientFish.java and use it as you work on your fabulous fish design.
Create a class called Fish_AB which controls the
drawing of a fish.
Your drawing should be more than a circle but less than a detailed drawing complete with scales. You can go back after you complete part II and make the fish more elaborate. For part I, I'm happy if it just has at least 3 non-trivial body parts, has at least 2 different kinds of shapes, and is clearly different in appearance from that of any other lab group. Be sure that at least one larger part is a filled shape. After the first 15 minutes or so of lab, a Fish & the provided client should always compile and have the following:
NOTE0:
**ALL** parts should fit within IMAGINARY rectangle defined by these values
you should go ahead and draw a red rectangle using them and keep it around
as you DESIGN your fish and get the parts where you want them.
However, when you are done you should remove all reference and drawing of
this rectangle!!!!
NOTE1:
these are not the "usual" for drawing a rectangle:
x,y is upper left corner
w is FULL SIDE length
h is FULL SIDE length
This make the math for the body parts simpler but...
slightly complicates the drawing of your rectangle:
StdDraw.rectangle( x+w/2, y-h/2, w/2, h/2 );
NOTE2: your constructor should assign all instance variables and as the very last thing call a draw method which you must also write that actually makes the drawing calls to StdDraw
NOTE3: all mutating methods should inclde a call to draw as the last thing so your beautiful work shows!!!
Test & retest your modified fish with your new FishyClient! Add the following methods to your Fish class and test for ALL OF THEM in your ANOTHER CLIENT OF YOUR OWN DEVISING. That is, your FishyClient will include something that calls all of the methods somehow in a way which is clear to the user and easily repeated in such a way that the user knows something happened because of what they've done.
Test & retest your modified fish with your new FishyClient!
Write a test client with the exact press method given. The method should be EXACTLY AS WRITTEN (except for replacing AB with the proper letters for YOUR fish):
Generate a random x, y, w, & h that will still be visible in your window at chosen scale.
draw a rectangle there.
now construct a fish using those exact same randomly chosen parameters.
}
Randomness belongs in Clients for your Fish class; not in the Fish themselves.
If the resulting fish are not exactly and completely inscribed by the resulting framed rectangle, one or more of your accessor methods is not working correctly. In some cases, the problem(s) may also go back to your constructor; the x & y value provided to the constructor should be the upper left point of the bounding box shrinkwrapping your fish and all it's fishy parts! Not sure what I mean by "shrinkwrap"? Or "exactly and completely inscribed"?
See examples from previous years...here
Use a TEMPORARY framed rectangle in your hardest working constructor and make sure all the parts are exactly constructed inside it. The frame should be constructed with the exact parameters sent and not modified in any way. It can be helpful to assign the frame to a local variable and set the color to something that contrasts with your fish so you can see when the parts stick out or don't fill up the frame.
When your fish and all it's fishy bits fit exactly inside the frame, then you should delete this TEMPORARY frame because it has done it's job. Fish perfection, (-:
Mail me your Fish_AB.java source code only.