import objectdraw.*; import java.awt.*; /** * Explain here what this class does * @author ??? your name * */ public class MagnetGame extends WindowController { /** * Explain here what the begin method does * */ public void begin() { // For your design, explain in more detail here (using pseudo-code) // how this is accomplished } /** * What? * * @param point -- location where mouse was pressed */ public void onMousePress(Location point) { // For your design, explain in more detail here how this is accomplished } /** * What? * * @param point -- location where mouse was dragged to */ public void onMouseDrag(Location point) { // For your design, explain in more detail here how this is accomplished } /** * What? * * @param point -- location where mouse was clicked */ public void onMouseClick( Location point) { // For your design, explain in more detail here how this is accomplished } } import objectdraw.*; import java.awt.*; /** * What does this class represent? Fill in the missing pieces of method bodies * and add new methods as needed. * @author ???? */ public class Magnet { // dimensions of magnets private static final double MAGNET_WIDTH = 150; private static final double MAGNET_HEIGHT = 50; // Box representing outline of magnet private FramedRect box; // Add other instance variables here as needed /** * What happens when magnet is constructed. How do the parameters * (that you need to add!) affect what happens? */ public Magnet( ) { // details on how to construct magnet } /** * @return the upper-left coordinates of the magnet */ public Location getLocation() { return box.getLocation(); } /** * Move the magnet by xoff to right and yoff down. * @param xoff -- distance to move horizontally * @param yoff -- distance to move vertically */ public void move(double xoff, double yoff) { // add pseudocode on how to move magnet } /** * Move the upper-left corner of magnet to location point * @param point -- place where magnet is to be moved. */ public void moveTo( Location point) { // add pseudocode on how to moveTo point } /** * The code for this method is incorrect. Fix it!! * @param point is location that want to check if it is within the magnet outline. * @return true if the given point is within the magnet */ public boolean contains( Location point ) { return false; // REPLACE THIS LINE OF CODE WITH THE CORRECT IMPLEMENTATION } /** * @return the width of the magnet */ public double getWidth() { return MAGNET_WIDTH; } /** * @return the height of the magnet */ public double getHeight() { return MAGNET_HEIGHT; } }