From what i can see i have made two man objects and two woman objects. it is failing on the condition of that "in the main method you need to created two objectss of each type".
I have run the program and the output appears to be correct also.
Any help is appreciated
many thanks
Tyler
package com.codegym.task.task05.task0526;
/*
Man and woman
*/
public class Solution {
public static void main(String[] args) {
Man man1 = new Man();
Man man2 = new Man();
System.out.println(man1.name + " " + man1.age + " " + man1.address);
System.out.println(man2.name + " " + man2.age + " " + man2.address);
Woman woman1 = new Woman();
Woman woman2 = new Woman();
System.out.println(woman1.name + " " + woman1.age + " " + woman1.address);
System.out.println(woman2.name + " " + woman2.age + " " + woman2.address);
}
public static class Man {
String name;
int age;
String address;
public Man (String name, int age, String address) {
this.name = name;
this.age = age;
this.address =address;
}
public Man () {
this.name = "Guy";
this.age = 18;
this.address = "Everywhere";
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public String getAddress(){
return address;
}
}
public static class Woman {
String name;
int age;
String address;
public Woman (String name, int age, String address) {
this.name = name;
this.age = age;
this.address = address;
}
public Woman () {
this.name = "Girl";
this.age = 18;
this.address = "Everywhere";
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public String getAddress(){
return address;
}
}
}