Help Understanding this question


Consider the following statement.

double rectanglePerimeter = someObject.calcRectanglePerimeter(1.5)

Write an instance method that calculates the perimeter of a rectangle using a class constant of 8 feet for the height of the rectangle. The value passed to the method represents the base of the rectangle in feet.


You posted this under javascript section on the forum, are you sure that is right?

double rectanglePerimeter looks more Java, given double makes it static typed (which java is), while javascript is dynamic typed. I assume you have Java

What is it you are struggling to understand? You need two classes:


in the rectangle class create a method named calcRectanglePerimeter

In the main method of main class, create a instance (object) of rectangle class. Then call calcRectanglePerimeter on the instance/object.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.