package com.javarush.task.task07.task0724;
/*
Семейная перепись
*/
import org.omg.PortableServer.THREAD_POLICY_ID;
public class Solution {
public static void main(String[] args) {
//напишите тут ваш код
Human grandFather = new Human("Евгений", true, 80);
Human grandFather2 = new Human("Николай", true, 78);
Human grandMother = new Human("Анна", false, 70);
Human grandMother2 = new Human("Евдокия", false, 90);
Human father = new Human("Анатолий", true, 60, grandFather, grandMother);
Human mother = new Human("Любовь", false, 63, grandFather2, grandMother2);
Human sun = new Human("Виктор", true, 37, father, mother);
Human daughters = new Human("Виктория", false, 27, father, mother);
Human sun2 = new Human("Василий", true, 17, father, mother);
System.out.println(grandFather);
System.out.println(grandFather2);
System.out.println(grandMother);
System.out.println(grandFather2);
System.out.println(father);
System.out.println(mother);
System.out.println(sun);
System.out.println(daughters);
System.out.println(sun2);
}
public static class Human {
//напишите тут ваш код
String name;
boolean sex;
int age;
Human father;
Human mother;
public Human(String name, boolean sex, int age) {
this.name = name;
this.sex = sex;
this.age = age;
}
public Human(String name, boolean sex, int age, Human father, Human mother) {
this.name = name;
this.sex = sex;
this.age = age;
this.father = father;
this.mother = mother;
}
public String toString() {
String text = "";
text += "Имя: " + this.name;
text += ", пол: " + (this.sex ? "мужской" : "женский");
text += ", возраст: " + this.age;
if (this.father != null)
text += ", отец: " + this.father.name;
if (this.mother != null)
text += ", мать: " + this.mother.name;
return text;
}
}
}
package com.javarush.task.task07.task0723;
/*
Обратный отсчёт
*/
public class Solution {
public static void main(String[] args) throws InterruptedException {
for (int i = 30; i >= 0; i--) {
System.out.println(i);
Thread.sleep(100);
//напишите тут ваш код
}
System.out.println("Бум!");
}
}