не понимаю почему для всех котов отец определяется правильно, а про мать пишется "no mother"
package com.javarush.task.task06.task0621;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Родственные связи кошек
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String grandpaName = reader.readLine();
Cat catGrandpa = new Cat(grandpaName, null, null);
String grannyName = reader.readLine();
Cat catGranny = new Cat(grannyName, null, null);
String fatherName = reader.readLine();
Cat catFather = new Cat(fatherName, null, catGrandpa);
String motherName = reader.readLine();
Cat catMother = new Cat(motherName, catGranny, null);
String sonName = reader.readLine();
Cat catSon = new Cat(sonName, catMother, catFather);
String daughterName = reader.readLine();
Cat catDaughter = new Cat(daughterName, catMother, catFather);
System.out.println(catGrandpa);
System.out.println(catGranny);
System.out.println(catFather);
System.out.println(catMother);
System.out.println(catSon);
System.out.println(catDaughter);
}
public static class Cat {
private String name;
private Cat parentMother;
private Cat parentFather;
Cat(String name, Cat parentMorher, Cat parentFather) {
this.name = name;
this.parentMother = parentMother;
this.parentFather = parentFather;
}
@Override
public String toString() {
String m = parentMother == null ? ", no mother" : ", mother is " + parentMother.name;
String f = parentFather == null ? ", no father" : ", father is " + parentFather.name;
return "The cat's name is " + name + m + f;
}
}
}