Question: 58. Design and code a program, including the following classes, as well as a client applet class to test all the methods coded: An abstract

 58. Design and code a program, including the following classes, as

58. Design and code a program, including the following classes, as well as a client applet class to test all the methods coded: An abstract Shape class, encapsulating a shape: a shape has one abstract method, draw, which takes one parameter, a Graphics object. Shape has three subclasses: O The Line class, encapsulating a line: A line can be represented by a starting (x, y) coordinate and an ending (x, y) coordinate. The draw method will draw a line between them. O The Rectangle class, encapsulating a rectangle: A rectangle can be represented by its (x y) top-left corner of the rectangle, its width, and its height. The draw method will draw the corre- sponding rectangle. The Oval class, encapsulating an oval: An oval can be repre- sented by the (x y) top-left corner coordinate of its bounding rectangle, its width, and its height. The draw method will draw the corresponding oval. Your applet class should prompt the user for the type of shape that the user wants to draw, prompt the user for the appropriate data, and then draw the figure in the applet window

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!