Java Square Calculate squareArea(final double side)

Here you can find the source of squareArea(final double side)

Description

Calculates the area of a square.

License

Apache License

Parameter

Parameter Description
side a double value indicating the length of the square's side.

Return

the area of a square given the length of a side.

Declaration

public static double squareArea(final double side) 

Method Source Code

//package com.java2s;
/*/*from  w  ww.  j a va2  s.c  o  m*/
 * Copyright 2016 Author or Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    /**
     * Calculates the area of a square.
     *
     * @param side a double value indicating the length of the square's side.
     * @return the area of a square given the length of a side.
     * @see #rectangleArea(double, double)
     */
    public static double squareArea(final double side) {
        return rectangleArea(side, side);
    }

    /**
     * Calculates the area of a rectangle.
     *
     * @param length a double value indicating the length of the rectangle.
     * @param height a double value indicating the height of the rectangle.
     * @return the area of a rectangle given the length and height.
     */
    public static double rectangleArea(final double length, final double height) {
        return (length * height);
    }
}

Related

  1. square2array(byte[][] square)
  2. square2Index(long square)
  3. squared(int x)
  4. squaredError(double[] vector1, double[] vector2)
  5. squaredLoss(double[] x, double[] y, double w_0, double w_1)
  6. squaredNorm(final double[] vec)