Right Triangle OOP Program
Description
This is an OOP program that uses RightTriangle objects to calculate the areas and perimeters of right triangles.The ADT (abstract data type) is RightTriangleClass.java.
The client program is RightTriangleClient.java.
Associated Concepts:
Object Oriented Programming (OOP)
Data member: instance variable
Instance method
Constructor
Getter and getter
toString method
Instance method
Constructor
Getter and getter
toString method
Algorithm:
For RightTriangleClass, the class diagram is represented in
UML (Unified Modeling Language) notation.
Client program:
Client program:
Create the first object using the non-default constructor
with the user input data
Use the object reference to call the methods to calculate the area and perimeter
Print the object's information
Create the second object using the default constructor
Set the second object's data members using setters
Use the object reference to call the methods to calculate the area and perimeter
Print the object's information
Compare two objects to determine which has the larger side 1
Double the size of the first object and print its information
Use the object reference to call the methods to calculate the area and perimeter
Print the object's information
Create the second object using the default constructor
Set the second object's data members using setters
Use the object reference to call the methods to calculate the area and perimeter
Print the object's information
Compare two objects to determine which has the larger side 1
Double the size of the first object and print its information