Question: In the code below, the method calcArea ( ) is an example of what principle? class Square private float side public setSide ( float value

In the code below, the method calcArea() is an example of what principle?
class Square
private float side
public setSide( float value ) returns nothing
this.side = value
public getSide() returns float s
s = this.side
public calcArea() returns float area
area = side * side
endclass
class Rectangle inheritsFrom Square
Declarations
private float longSide
public setLongSide( float value ) returns nothing
this.longSide = value
public getLongSide() returns float side
side = this.longSide
public calcArea() returns float area
area = this.side * this.longSide
endclass

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!