logo image

Java program to find Area, Perimeter of a Rhombus



Rhombus is a Parallelogram with all equal sides. Following image shows you how a Rhombus looks like

info-about-image

Following is the java program that takes Length, Height as inputs and compute Area, Perimeter of a Rhombus

import java.util.Scanner;

public class AreaAndPerimeterOfRhombus {
	public static void main(String[] args) {

		// Taking inputs from user
		Scanner sc = new Scanner(System.in);

		System.out.print("Enter the Length: ");
		double length = sc.nextDouble();
		
		System.out.print("Enter the Height: ");
		double height = sc.nextDouble();

		sc.close();

		double area = length * height;
		double perimeter = 4 * length;
		
		System.out.println("Area: " + area);
		System.out.println("Perimeter: " + perimeter);
	}
}

Output

Enter the Length: 4
Enter the Height: 3
Area: 12.0
Perimeter: 16.0