The function that we use to check two object equality is if statement or conditional and we use Java.
The code is,
import java.util.*;
public class temp
{
public static void main(String [] args)
{
Scanner s = new Scanner(System.in);
double fn1, sn1, sn2;
System.out.println("Enter the side length of the first regular polygon:");
fn1 = double.parseDouble(s.nextLine());
RegularPolygon fp = new RegularPolygon(fn1);
System.out.println("Enter the number of sides of the second polygon:");
sn1 = double.parseDouble(s.nextLine());
System.out.println("Enter the side length of the second polygon:");
sn2 = double.parseDouble(s.nextLine());
RegularPolygon sp = new RegularPolygon(sn1, sn2);
if(fp.equals(sp))
{
System.out.println("Congruent Regular Polygons!");
}
else
{
System.out.println("Different Regular Polygon.");
}
}
}
Variable of fn1 is used to contain input value for first polygon.
Variable of sn1 and sn2 is used to contain input value for second polygon.
Variable of fp is used to contain value of first polygon and sp is used to contain value of second polygon.
If statement is used to compare fp and sp for equality.
If two polygon equal then the print statement in body of if statement will run, if two polygon different then the print statement in body of else statement will run.
Learn more about if statement here:
brainly.com/question/17031764
#SPJ4