Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed
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

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

Step: 3

blur-text-image

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

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions