Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write an interface called Moveable with four void methods moveUp(), moveDown(), moveLeft() and moveRight(). 2. Write a class called MoveablePoint that implements the Moveable

1. Write an interface called Moveable with four void methods moveUp(), moveDown(), moveLeft() and moveRight().

2. Write a class called MoveablePoint that implements the Moveable interface above. This class contains two int fields x and y. Write the constructors, accessors and mutators, toString method and an equals (inherited from Object class) method that compares the states of its objects.

3. Write another class called MoveableCircle that extends the MoveablePoint. The x and y fields represent the center of the circle and has an int variable called radius. Write the constructors, accessors and mutators, toString method, equals method and a method called area that print the area of the circle.

4. Write a client class that creates the two objects of MoveablePoint and two objects of MoveableCircle class. Test the moveUp(), moveDown(), moveLeft(), moveRight() methods for each object and print the object with each move. Also use the equals method to compare different objects and print out the results of the comparision. Call the area method on the objects of class MoveableCircle.

image text in transcribed

> Moveable MoveableCircle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions