Java program to calculate land price with land area

Java program to calculate land price with land area. They offer cheap independent home layouts, apartments, and private villas. The management of Thilagar Real Estate intends to offer a significant discount to its customers. The discount is calculated based on the amount of land that has been reserved or purchased. Write a Java program to determine the total price the buyer must pay, taking into account any discounts that may be available.

import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
double total =0;
System.out.println("Enter the land buyer name");
String name =sc.nextLine();
System.out.println("Enter the lands size in acres");
int area = sc.nextInt();
sc.nextLine();
if(area>=400 && area<=599){
total = area*1700;
total = total * 0.95;
}
else if(area>=600 && area<=999){
total = area*1900;
total = total * 0.95;
}
else if(area>=1000 && area<=2600){
total = area*2600;
total = total * 0.96;
}
else if(area>=2500 && area<=3000){
total = area*2800;
total = total * 0.97;
}
else{
System.out.println(area+" is out of range");
return;
}
System.out.println("Total amount after discount is \n"+total);
}
}

 

Output:

Enter the land buyer name
Raghu
Enter the lands size in acres
500
Total amount after discount is
807500.0

What is if else statement in java and how to implement if else condition

The conditional statements in Java are as follows: If a particular condition is true, use if to specify a block of code to be run. If the same condition is false, use otherwise to specify a block of code to run. If the initial condition is false, use else if to define a new condition to test.

What is AND operator in java program

If both operands are true, the logical AND operator (&&) returns true; otherwise, it returns false. The logical AND operator’s operands do not have to be of the same type, but they must be of the boolean, integral, or pointer type. Relational or equality expressions are frequently used as operands.

What is acres and how to calculate in java program

Multiply your length and width to get square feet to calculate acres by hand. If you need to convert lengths, use our length conversion tools. Then divide the result by 43,560 to get the land area in acres. Using our square feet area calculator, you can rapidly calculate the square footage of a given space.

What is hectare and how to calculate in java program

In the metric system, a hectare is equal to 100 acres, or 10,000 square meters, and in the British Imperial System and the United States Customary measure, a hectare is equal to 2.471 acres. The name comes from the Latin word area and the Greek word hecter, which is an irregular abbreviation of the word hundred.