So i had to write a program that uses these functions to add, subtract, multiply and see if the numbers equal each other. and also You must create a way to keep track of the relationships between friends, the spouses, the siblings, the children of the men and women. attached is the requirements.

```
import java.util.Scanner;
public class lhlFamily {
char[][] mem=new char[100][100];
int cnt;
public lhlFamily()
{
Scanner key = new Scanner(System.in);
System.out.println("Enter count of members");
cnt=Integer.parseInt(key.nextLine());
int i,j,k;
for(i=0;i<cnt;i++)
{
for(j=i+1;j<cnt;j++)
{
System.out.println("Enter relationship of "+i+" and "+j+" Enter 'n' if not directly connected");
String r=key.nextLine();
mem[i][j]=r.charAt(0);
}
}
}
int plus(int x,int y)
{
return (x+y);
}
int minus(int x,int y)
{
return (x-y);
}
int times(int x,int y)
{
return (x*y);
}
boolean equals(int x,int y)
{
if(x==y)
return true;
else
return false;
}
boolean friend(int x,int y)
{
if(x<y)
{
if(mem[x][y]=='f')
return true;
else
return false;
}
else
{
if(mem[y][x]=='f')
return true;
else
return false;
}
}
void friends(int x)
{
int i=0;
System.out.print("Friends of "+x+" are ");
for(i=1;i<x;i++)
{
if(mem[i][x]=='f')
System.out.print(i+"\t");
}
for(i=x+1;i<cnt;i++)
{
if(mem[x][i]=='f')
System.out.print(i+"\t");
}
System.out.print("\n");
}
boolean father(int x,int y)
{
boolean f=false;
if(mem[x][y]=='f'||mem[y][x]=='f')
return true;
else
{
int i,mother=0;
for(i=1;i<x;i++)
{
if(mem[i][x]=='m')
{
mother=i;
break;
}
}
if(mother==0)
{
for(i=x+1;i<cnt;i++)
{
if(mem[x][i]=='m')
{
mother=i;
break;
}
}
}
for(i=1;i<mother;i++)
{
if(mem[i][mother]=='h'&&i==y)
{
f=true;
break;
}
}
if(!f)
{
for(i=mother+1;i<cnt;i++)
{
if(mem[mother][i]=='h'&&i==y)
{
f=true;
break;
}
}
}
return f;
}
}
boolean mother(int x,int y)
{
boolean m=false;
if(mem[x][y]=='m'||mem[y][x]=='m')
return true;
else
{
int i,father=0;
for(i=1;i<x;i++)
{
if(mem[i][x]=='f')
{
father=i;
break;
}
}
if(father==0)
{
for(i=x+1;i<cnt;i++)
{
if(mem[x][i]=='f')
{
father=i;
break;
}
}
}
for(i=1;i<father;i++)
{
if(mem[i][father]=='w'&&i==y)
{
m=true;
break;
}
}
if(!m)
{
for(i=father+1;i<cnt;i++)
{
if(mem[father][i]=='w'&&i==y)
{
m=true;
break;
}
}
}
return m;
}
}
boolean sibling(int x,int y)
{
if(mem[x][y]=='s'||mem[y][x]=='s')
return true;
else
return false;
}
public static void main(String[] args) {
Family f=new Family();
int x,y;
Scanner key = new Scanner(System.in);
System.out.println("Enter 2 numbers which need to be checked for friend relation");
x=Integer.parseInt(key.nextLine());
y=Integer.parseInt(key.nextLine());
System.out.println("The friend relationship between "+x+" and "+y+" is "+f.friend(x,y));
System.out.println("Enter a number whose friends need to be displayed");
x=Integer.parseInt(key.nextLine());
f.friends(x);
System.out.println("Enter 2 numbers which need to be checked for father relation");
x=Integer.parseInt(key.nextLine());
y=Integer.parseInt(key.nextLine());
System.out.println("The father relationship between "+x+" and "+y+" is "+f.father(x,y));
System.out.println("Enter 2 numbers which need to be checked for mother relation");
x=Integer.parseInt(key.nextLine());
y=Integer.parseInt(key.nextLine());
System.out.println("The mother relationship between "+x+" and "+y+" is "+f.mother(x,y));
System.out.println("Enter 2 numbers which need to be checked for sibling relation");
x=Integer.parseInt(key.nextLine());
y=Integer.parseInt(key.nextLine());
System.out.println("The sibling relationship between "+x+" and "+y+" is "+f.sibling(x,y));
}
}
```