Untitled

 avatar
unknown
plain_text
5 months ago
1.3 kB
3
Indexable
import java.util.Scanner;

class Labfinal {
    public static void Area() {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter the radius:");
        double a = input.nextDouble();
        double areacircle = Math.PI * Math.pow(a, 2);
        System.out.println("The area of a circle is: " + areacircle);
    }

    public static void calculateRectangleArea() {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter the length of the rectangle: ");
        double length = scanner.nextDouble();
        System.out.print("Enter the width of the rectangle: ");
        double width = scanner.nextDouble();
        double area = length * width;
        System.out.println("The area of the rectangle is: " + area);
    }

    public static void calculateCubeVolume() {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter the side of the cube: ");
        double side = scanner.nextDouble();
        double volume = side * side * side;
        System.out.println("The volume of the cube is: " + volume);
    }


    public static void main(String[] args) {
        Area();
        calculateRectangleArea();
        calculateCubeVolume();
    }
}
Editor is loading...
Leave a Comment