Program to calculate area of a parallelogram | Java program for above approach ; Function to return the area of parallelogram using sides and angle at the intersection of diagonal ; Calculate area of parallelogram ; Return the answer ; Function to return the area of parallelogram using sides and angle at the intersection of sides ; Calculate area of parallelogram ; Return the answer ; Function to return the area of parallelogram using diagonals and angle at the intersection of diagonals ; Calculate area of parallelogram ; Return the answer ; Driver code ; Given diagonal and angle ; Function call ; Print the area
import java . io . * ; class GFG { static double Area_Parallelogram1 ( int a , int b , int theta ) { double area = ( Math . abs ( Math . tan ( Math . toRadians ( theta ) ) ) / 2 ) * Math . abs ( a * a - b * b ) ; return area ; } static double Area_Parallelogram2 ( int a , int b , int gamma ) { double area = ( Math . abs ( Math . sin ( Math . toRadians ( gamma ) ) ) ) * Math . abs ( a * b ) ; return area ; } static double Area_Parallelogram3 ( int d1 , int d2 , int theta ) { double area = ( Math . abs ( Math . sin ( Math . toRadians ( theta ) ) ) / 2 ) * Math . abs ( d1 * d2 ) ; return area ; } public static void main ( String [ ] args ) { int d1 = 3 ; int d2 = 5 ; int theta = 90 ; double area = Area_Parallelogram3 ( d1 , d2 , theta ) ; System . out . format ( " % .2f " , area ) ; } }