Fill in the blanks in the code to create a Rectangle class with a method that calculates the area of a rectangle. The main method should call this method and print the result for a rectangle with length 5.0 and width 3.0.
Declaring methods
Rectangles: The shape of things to sum
Report a typo
Fill in the gaps with the relevant elements
class Rectangle {
public double calculateRectangleArea(double length, double width) {
return length * width;
}
public static main(String[] args) {
System.out.println(calculateRectangleArea(5.0, 3.0));
}
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.