Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IDE : TEXTPAD Design a new Triangle class that extends the abstract GeometricObject class. Write a test program that prompts the user to enter three

IDE : TEXTPAD

Design a new Triangle class that extends the abstract GeometricObject class.

Write a test program that prompts the user to enter three sides of the triangle (make sure they define an actual triangle), a color, and a Boolean value to indicate whether the triangle is filled. The program should then create a Triangle object with these sides and set the color and filled properties using the input. In addition, have the program make use of constructors to add circle and rectangle objects. The program should display, for each of these geometric objects, the area, perimeter, color, and true or false to indicate whether it is filled or not. Place all of the classes in a single Java soruce file named TestGeometricObjects.java. Make sure that the class that contains the main method is also named public class TestGeometricObjects, and that the Triangle, Circle, and Rectangle classes are not public.

The output for this program might be fornatted to look something like the following:

Please enter the sides of a triangle: 2 4 78 Unable to create a triangle with those sides.

Please enter the sides of a triangle: 3 4 5 What is the color of the triangle: red Is the triangle filled(true/false)?: true

Triangle: Area: 6.0 Perimeter: 12.0 Color: red Filled: true

Circle: Area: 12.56 Perimeter: 12.56 Color: yellow Filled: true

Rectangle: Area 8.0 Perimeter 12.0 Color: red Filled: false Press any key to continue . . .

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

An ICER value indicates which of two treatment options is better.

Answered: 1 week ago