Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.codegym.task.task06.task0621;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- /*
- Cat relations
- */
- public class Solution {
- public static void main(String[] args) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- String gf,gm,f,m,s,d;
- gf = reader.readLine();
- gm=reader.readLine();
- f=reader.readLine();
- m=reader.readLine();
- s=reader.readLine();
- d=reader.readLine();
- System.out.println(catMother);
- System.out.println(catDaughter);
- }
- public static class Father {
- private String father;
- Father(String father)
- {
- this.father = father;
- }
- }
- public static class Mother {
- public String mother;
- Mother(String mother){
- this.mother =mother;
- }
- }
- public static class Cat {
- private String name;
- private Father father;
- private Mother mother;
- Cat(String name,Father father,Mother mother) {
- this.name = name;
- this.father = father;
- this.mother = mother;
- }
- @Override
- public String toString() {
- if (father == null && mother==null)
- return "The cat's name is " + name + ", no mother "+", no father";
- else if(father!=null && mother ==null)
- return "The cat's name is " + name + ", no mother ," + father.name + " is the father"+;
- }
- }
- }
Add Comment
Please, Sign In to add comment