Question: In eclipse Lab Requirements Suppose that we have a set of objects with some common behaviors: they could move up, down, left or right. The

In eclipse
 In eclipse Lab Requirements Suppose that we have a set of
objects with some common behaviors: they could move up, down, left or
right. The exact behaviors/implementations (such as how to move and how far

Lab Requirements Suppose that we have a set of objects with some common behaviors: they could move up, down, left or right. The exact behaviors/implementations (such as how to move and how far to move) depends on the objects themselves. One common way to model these common behaviors is to define an interface. In this case, an you will define an interface called Movable, with interface methods moveUp(), moveDown(), moveLeft(), and moveRight all of which return void. (5 points) Write two concrete classes MovablePoint and Movablecircle -that implement the Movable interface. These classes that implement the Movable interface will provide actual implementation to the (abstract) interface methods. Movable Point Class (10 points) For the MovablePoint class, declare the instance variables x, y, xSpeed and yspeed; which represent the x location, y location, speed in the x direction, and speed in the y direction. Make getters and setters for the speed variables only, and one constructor that sets all the (4) instance variables. XSpeed and YSpeed can be positive numbers only, so make sure you program them accordingly (smart setters). Override toString()to an appropriate representation. Implement the movable interface with "logical" implementations that utilize these instance variables. For the MovablePoint, you should be using your ySpeed and xSpeed values for the moveUp/Down and moveLeft/Right methods, respectively. And, you shouldn't be changing your speed in those methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!