0% found this document useful (0 votes)
4 views4 pages

GeometricObject Class Tutorial

The document outlines a tutorial for creating an abstract class called GeometricObject and its subclasses Circle and Rectangle. It also includes an exercise to design a Triangle class that extends GeometricObject, prompting user input for the triangle's sides, color, and fill status, and displaying its area, perimeter, and properties. Code examples are provided for implementation.

Uploaded by

FarhanAshraf
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

GeometricObject Class Tutorial

The document outlines a tutorial for creating an abstract class called GeometricObject and its subclasses Circle and Rectangle. It also includes an exercise to design a Triangle class that extends GeometricObject, prompting user input for the triangle's sides, color, and fill status, and displaying its area, perimeter, and properties. Code examples are provided for implementation.

Uploaded by

FarhanAshraf
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Tutorials

1. Write GeometricObject Abstract class and its’ sub classes:


Circle and Rectangle as below

Code:
Exercises
2. Design a new Triangle class that extends the abstract
GeometricObject class. Write the Triangle
class.
Write a test program that prompts the user to enter three sides
of the triangle, a color, and a Boolean value to indicate whether
the triangle is filled. The program should create a Triangle object
with these sides and set the color and filled properties using the
input. The program should display the area, perimeter, color, and
true or false to indicate whether it is filled or not.

Code:
Output:

You might also like