A. Write the classes as shown in the following class diagram. Movable is an interface and MovablePoint implements it. '-' means package access but you can just make it public. Movable «interface>> +moveUp():void +moveDown (): void +moveleft(): void +moveRight():void abstract methods implements MovablePoint x:int my:int xSpeed:int ySpeed:int denotes package access "(x, y) speed-(x, y)" +MovablePoint (x:int,y:int,- xSpeed:int, ySpeed: jnt) +tostring():String y -- ySpeed +moveUp():void +moveDown (): void +moveleft():void +moveRight(): void movelp: moveDown: y += ySpeed moveleft: x -= xSpeed moveRight: x += xSpeed

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

java language

A. Write the classes as shown in the following class diagram. Movable is an interface
and MovablePoint implements it. '-' means package access but you can just make it
public.
Movable
einterface>>
+moveUp():void
+moveDown (): void
+moveleft():void
+moveright():oid
abstract methods
implements
MovablePoint
-x:int
- denotes package access
y:int
xSpeed:int
ySpeed:int
"(x, y) speed-(x, y)"
+MovablePoint (x:int,y:int,
xSpeed:int, ySpeed: jnt)
+tostring():string•
+moveUp(): void
+moveDown (): void
+moveleft():void
+moveRight(): void
movellp:
y -- ySpeed
moveDown: y + ySpeed
x -= xSpeed
moveRight: x += xSpeed
moveleft:
Transcribed Image Text:A. Write the classes as shown in the following class diagram. Movable is an interface and MovablePoint implements it. '-' means package access but you can just make it public. Movable einterface>> +moveUp():void +moveDown (): void +moveleft():void +moveright():oid abstract methods implements MovablePoint -x:int - denotes package access y:int xSpeed:int ySpeed:int "(x, y) speed-(x, y)" +MovablePoint (x:int,y:int, xSpeed:int, ySpeed: jnt) +tostring():string• +moveUp(): void +moveDown (): void +moveleft():void +moveRight(): void movellp: y -- ySpeed moveDown: y + ySpeed x -= xSpeed moveRight: x += xSpeed moveleft:
B. Now add the class MovableCircle which also implements the interface Movable and is
composed of a MovablePoint. Add a tester that allows the user to enter the radius
and center of a MovableCircle. After that ask the user if they want (yes/no) to move
the circle and how they want to move it (up, down, left, right). Everytime the circle is
moved, you should output its changed position. If the user says "no" the program
ends.
«interface>> Movable
+moveUp():void
+moveDown():void
+moveleft(): void
+moveright():void
implements 4
MovablePoint
Movablecircle
x:int
wy:int
-xSpeed: int
nySpeed:int
-radius:int
1
-center: MovablePoint
+MovablePoint(x:int,y:int,
xSpeed: int,ySpeed:int)
+tostring():String
+moveUp(): void
+moveDown ():void
+moveleft ():void
+moveRight():void
composes MovableCircle(x:int,y:int
xSpeed:int, ySpeed:int,
radius:int)
+tostring():String
+moveUp(): void
+moveDown ():void
+moveleft():void
+moveRight(): void
Transcribed Image Text:B. Now add the class MovableCircle which also implements the interface Movable and is composed of a MovablePoint. Add a tester that allows the user to enter the radius and center of a MovableCircle. After that ask the user if they want (yes/no) to move the circle and how they want to move it (up, down, left, right). Everytime the circle is moved, you should output its changed position. If the user says "no" the program ends. «interface>> Movable +moveUp():void +moveDown():void +moveleft(): void +moveright():void implements 4 MovablePoint Movablecircle x:int wy:int -xSpeed: int nySpeed:int -radius:int 1 -center: MovablePoint +MovablePoint(x:int,y:int, xSpeed: int,ySpeed:int) +tostring():String +moveUp(): void +moveDown ():void +moveleft ():void +moveRight():void composes MovableCircle(x:int,y:int xSpeed:int, ySpeed:int, radius:int) +tostring():String +moveUp(): void +moveDown ():void +moveleft():void +moveRight(): void
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,