Thursday 14 December 2017

Converts Acre to Hectares and vice-versa in Java

 Acre


  • The acre is unit of land area used in the imperial and US customary systems.
  • The international symbol of the acre is ac. The most commonly used acre today is the international acre.
  • One acre equals 0.0015625 square miles, 4,840 square yards, 43,560 square feet.
  • 1 acre (both variants) is equal to the following customary units:          
                  66 feet × 660 feet (43,560 square feet)

Hectares


  • The hectare is an SI accepted metric system unit of area equal to 100 ares (10,000 m2) or 1 square hectometre (hm2) and primarily used in the measurement of land as a metric replacement for the imperial acre.

Write a program that converts acres to hectares and vice-versa.

Program:


import java.util.Scanner;
class hectares{
   public static void main(String ag[]){
Scanner sc=new Scanner(System.in);
float h,a,m,n;
System.out.println("Enter the Acres");
a=sc.nextFloat();
m=a/2.41f;
System.out.println("The Hectares is "+m);

System.out.println("Enter the Hectares");
h=sc.nextFloat();
n=h*2.41f;
System.out.println("The Acres is "+n);
    }

}

OUTPUT:


No comments:

Post a Comment