how to measure acres in java code example
Example 1: area of circle in java
import java.util.Scanner;
public class AreaOfCircle {
public static void main(String args[]){
int radius;
double area;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the radius of the circle ::");
radius = sc.nextInt();
area = (radius*radius)*Math.PI;
System.out.println("Area of the circle is ::"+area);
}
}
Example 2: Java program to calculate area of rectangle
import java.util.Scanner;
public class RectangleArea
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Please enter length of rectangle: ");
double length = sc.nextDouble();
System.out.println("Please enter width of rectangle: ");
double width = sc.nextDouble();
double area = length * width;
System.out.println("Area of rectangle is: " + area);
sc.close();
}
}