PL/SQL Method to Determine whether a Shape is a Square or not
PL/SQL OOP: Exercise-6 with Solution
Write a PL/SQL code that implement a method in the "Shape" class to determine if the shape is a square or not.
Sample Solution:
PL/SQL Code:
Now the following code is the instances of the class "Shape" with the "isSquare" method, and check whether they represent squares or not.
PL/SQL Code:
Sample Output:
Statement processed. The rectangle is not a square. The square is a square.
Flowchart:


Explanation:
The said code in Oracle's PL/SQL that demonstrated how to create instances of the "Shape" class and use the "isSquare" method to determine if the shapes are squares or not.
The class "Shape" is declared that have attributes that describe the shape's properties, such as length, width, or sides and it contains a method "isSquare" to check whether the shape is a square or not.
For a shape to be considered a square, it needs to have equal length sides and right angles.
Previous: Creating a "Shape" Class in PL/SQL with Area Calculation Method.
What is the difficulty level of this exercise?