Текст проверил, вроде всё вплоть до пробелов сходится...
Помогите разобраться, что не так
package com.javarush.task.task06.task0621;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Родственные связи кошек
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String gFatherName = reader.readLine();
Cat gFather = new Cat(gFatherName, "no mother", "no father");
String gMotherName = reader.readLine();
Cat gMother = new Cat(gMotherName, "no mother", "no father");
String fatherName = reader.readLine();
Cat father = new Cat(fatherName, "no mother", gFather.name);
String motherName = reader.readLine();
Cat mother = new Cat(motherName, gMother.name, "no father");
String sonName = reader.readLine();
Cat son = new Cat(sonName, mother.name, father.name);
String daughterName = reader.readLine();
Cat daughter = new Cat(daughterName, mother.name, father.name);
Cat.cats.add(gFather);
Cat.cats.add(gMother);
Cat.cats.add(father);
Cat.cats.add(mother);
Cat.cats.add(son);
Cat.cats.add(daughter);
for (Cat x : Cat.cats)
if (x.father.equals(gFather.father) && x.mother.equals(gFather.mother))
System.out.println("The cat's name is " + x.name + ", " + x.mother + ", " + x.father);
else {
if (x.father.equals(gFather.father))
System.out.println("The cat's name is " + x.name + ", mother is " + x.mother + ", " + x.father);
else {
if (x.mother.equals(gFather.mother))
System.out.println("The cat's name is " + x.name + ", " + x.mother + ", father is " + x.father);
else
System.out.println("The cat's name is " + x.name + ", mother is " + x.mother + ", father is " + x.father);
}
}
}
public static class Cat {
private static ArrayList<Cat> cats = new ArrayList<>();
private String name;
private String mother;
private String father;
Cat(String name, String mother, String father) {
this.name = name;
this.mother = mother;
this.father = father;
}
Cat(){
}
// Cat(String name, Cat parent) {
// this.name = name;
// this.parent = parent;
//}
//@Override
//public String toString() {
// if (parent == null)
// return "The cat's name is " + name + ", no mother ";
// else
// return "The cat's name is " + name + ", mother is " + parent.name;
// } */
}
}