Question: Java Q4 You need to implement a program that draws different figures based on user choice. You need to implement the following class hierarchy Shape

Java
 Java Q4 You need to implement a program that draws different

Q4 You need to implement a program that draws different figures based on user choice. You need to implement the following class hierarchy Shape Oval Square Triangle Shape is an abstract class that has draw as an abstract class, draw takes the index of the shape in the array of shapes. Each other class (Oval, Square, Triangle) implements draw and calculates the starting position of index. In the test class promote the user to enter the number of requested shapes of each type. Then creates the requested number of each shape type and save them in an array. In a for loop it draws each shape Sample Output: Number of Ovals: 2 Number of Triangles: 2 Number of Squares: 3 the shape using the provided

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!