## Logic behind object oriented programming, C/C++ Programming

Assignment Help:

In this we will take a closer look at the logic behind Object Oriented Programming.  Read through the pseudocode listed below and answer the following questions.

Class Square

Declare Protected Side as Float

Declare Protected Area as Float

Public Square()

Set Side = 1.0

Set Area = 1.0

End Constructor

Public Subprogram SetSide(NewSide)

Set Side = NewSide

End Subprogram

Public Subprogram ComputeArea()

Set Area = Side^2

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

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

Question1:Give the names of the methods of the class Square.

Question 2:Write the statement that would be used in the main program to create a new object Square1 based off of the Square Class.

Question 3: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()?

Question 4:Write the statement that would be used in the main program to set a side of Square1 to 20.

Question 5:Write the statements that would be used in the main program to compute the area of Square1, assign it to a variable called Area and then print it to the screen.

#### Area under curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. #include float start_point,

#### Operators and their expression in cpp, Operators in C++: All C operator...

Operators in C++: All C operators are valid operators in C++ also.  Besides C++ has developed some new operators like Operators and their Expression: 1.      Logical op

#### Mathematics, C Coding to find the area under the curve y = f(x) between x =...

C Coding to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can be found

#### Assignment, Hi, Can i get a quote for my Programming assignment

Hi, Can i get a quote for my Programming assignment

#### Area under curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

#### Require flowchart, I require a flowchart for push , & pop operation on stac...

I require a flowchart for push , & pop operation on stack using array

#### What is the real function of class - to export data, What is the real funct...

What is the real function of class - to export data? No, Real purpose of a class isn't to export data. Instead, it's to provide services. Class provides a way to abstract behav

#### HASHING, What is meant by open addressing? Explain various collision resolu...

What is meant by open addressing? Explain various collision resolution techniques with example

Comments Comments are integral part of every program . Comments help in coding, debugging and maintaining a program . The compiler ignores them. They should be used liberally i

#### Application for tag in the forest game, Your program should use the Free Pa...

Your program should use the Free Pascal compiler or the Lazarus IDE described in CSC 540. When you hand in your assignment to the digital dropbox, it should be a .PAS file, not zip