# Java Program to Convert Acer to Square meter and Square meter to Acer

In the previous article, we have discussed about Java Program to Convert Acer to Square foot and Square foot to Acer

In this article we will see how to convert acer to square meter and square meter to acer by using Java programming language.

## Java Program to Convert Acer to Square meter and Square meter to Acer

Before jumping into the program let’s know the relationship between acer and square meter and how we can convert acer to square meter and vice-versa.

Generally acer and square meter are used as unit in case of land measurement.

1 Acer = 4046.86 Square meter
1 Square meter = 0.000247105 Acer

Formula to convert acer to square meter.

Square meter = Acer * 4046.86

Formula to convert square meter to acer .

Acer = Square meter * 0.000247105

Let’s see different ways to convert acer to square meter and square meter to acer.

### Method-1: Java Program to Convert Acer to Square meter and Square meter to Acer By Using Static Input Value

Approach:

• Declare user input of acer and square meter value.
• Then convert acer to square meter and square meter to acer by using the formula.
• Print result.

Program:

public class Main
{
public static void main(String args[])
{
//value of acer declared
double acer = 1;
//value of square meter declared
double squaremeter = 1;

//converting square meter to acer value
double a = squaremeter * 0.000247105;
//converting acer to square meter value
double sm = acer * 4046.86;
//printing result
System.out.println("Value of "+squaremeter+" square meter in acer: "+ a);
System.out.println("Value of "+acer+" acer in square meter: "+ sm);
}
}
Output:

Value of 1.0 square meter in acer: 2.47105E-4
Value of 1.0 acer in square meter: 4046.86

### Method-2: Java Program to Convert Acer to Square meter and Square meter to Acer By Using User Input Value

Approach:

• Take user input of acer and square meter value.
• Then convert acer to square meter and square meter to acer by using the formula.
• Print result.

Program:

import java.util.*;

public class Main
{
public static void main(String args[])
{
//Scanner class object created
Scanner sc=new Scanner(System.in);
//Taking the value input of double variable acer
System.out.println("Enter value of acer: ");
double acer = sc.nextDouble();
//Taking the value input of double variable squaremeter
System.out.println("Enter value of square meter: ");
double squaremeter = sc.nextDouble();

//converting square meter to acer value
double a = squaremeter * 0.000247105;
//converting acer to square meter value
double sm = acer * 4046.86;
//printing result
System.out.println("Value of "+squaremeter+" square meter in acer: "+ a);
System.out.println("Value of "+acer+" acer in square meter: "+ sm);
}
}
Output:

Enter value of acer:
20
Enter value of square meter:
20000
Value of 20000.0 square meter in acer: 4.9421
Value of 20.0 acer in square meter: 80937.2

### Method-3: Java Program to Convert Acer to Square meter and Square meter to Acer By Using User Defined Method

Approach:

• Take user input of acer and square meter value.
• Call a user defined method by passing acer and square meter value as parameter.
• Inside method convert acer to square meter and vice versa by using the formula.
• Print result.

Program:

import java.util.*;

public class Main
{
public static void main(String args[])
{
//Scanner class object created
Scanner sc=new Scanner(System.in);
//Taking the value input of double variable acer
System.out.println("Enter value of acer: ");
double acer = sc.nextDouble();
//Taking the value input of double variable squaremeter
System.out.println("Enter value of square meter: ");
double squaremeter = sc.nextDouble();
//calling user defined method convert()
convert(acer, squaremeter);
}

//convert() method to convert acer to squaremeter and vice versa
public static void convert(double acer, double squaremeter)
{

//converting square meter to acer value
double a  = squaremeter * 0.000247105;
//converting acer to square meter value
double sm = acer * 4046.86;
//printing result
System.out.println("Value of "+squaremeter+" square meter in acer: "+ a);
System.out.println("Value of "+acer+" acer in square meter: "+ sm);
}
}
Output:

Enter value of acer:
2
Enter value of square meter:
10000
Value of 10000.0 square meter in acer: 2.47105
Value of 2.0 acer in square meter: 8093.72

Guys who are serious about learning the concepts of the java programming language should practice this list of programs in java and get a good grip on it for better results in exams or interviews.

Related Java Programs: