Answer to Question #319811 in Java | JSP | JSF for rose

Question #319811

Write a program that calculates the area of the following figures:

·        A square of side 0.666666667

·        A rectangle of sides 1/9 and 4

Test the two calculated areas for equality. If the areas are equal output “The area of the two figures are equal” else output “The area of the two figures are not equal”


1
Expert's answer
2022-03-28T16:11:00-0400
public class CalculationArea {

    public static double squareAreaCalcSquare(double Side){
        return Side*Side;
    }
    public static double rectangleAreaCalcSquare(double firstSide,double secondSide){
        return firstSide*secondSide;
    }
    public static void main(String args[]){
        double squareSide = 0.666666667;
        double rectangleFirstSide = 1/9;
        double rectangleSecondSide = 4;
        if(squareAreaCalcSquare(squareSide)==rectangleAreaCalcSquare(rectangleFirstSide,rectangleSecondSide)){
            System.out.println("The area of the two figures are equal.");
        }
        else{
            System.out.println("The area of the two figures are not equals.");
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS