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_2

Step: 3

blur-text-image_3

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 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

Her response see the attached memo is disturbing.

Answered: 1 week ago

Question

What is American Polity and Governance ?

Answered: 1 week ago

Question

What is Constitution, Political System and Public Policy? In India

Answered: 1 week ago

Question

What is Environment and Ecology? Explain with examples

Answered: 1 week ago