Question: Suppose Rectangle1 is an object of the class Rectangle and the statement Call Rectangle1.ComputeArea() appears in the main program. Which formula for area is used
Suppose Rectangle1 is an object of the class Rectangle and the statement
Call Rectangle1.ComputeArea()
appears in the main program. Which formula for area is used in the execution of the subprogram ComputeArea()?

Class Square Declare Protected Side, Area As Float Public Square() Set Side 1.0 %3! Set Area = 1.0 End Constructor Public Subprogram SetSide (NewSide) Set Side = NewSide End Subprogram Public Subprogram ComputeArea () Set Area = Side^2 %3! End Subprogram Public Function GetArea() As Float Set GetArea = Area End Function Public Function GetSide () As Float Set GetSide = Side End Function End Class Class Rectangle Extends Square Declare Private Height As Float Public Rectangle() Call Square () Set Height = 1.0 %3! End Constructor Public Subprogram SetHeight (NewHeight) Set Height = NewHeight End Subprogram Public Function GetHeight() As Float Set GetHeight = Height End Function Public Subprogram ComputeArea () Set Area = Side * Height End Subprogram End Class
Step by Step Solution
3.48 Rating (168 Votes )
There are 3 Steps involved in it
Are... View full answer
Get step-by-step solutions from verified subject matter experts
