Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started