Help Understanding this question


#1

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.


#2

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:

main
rectangle

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.


#3

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