diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..1527899 --- /dev/null +++ b/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + reynoldstitko.gillian + ReuseClasses + 1.0-SNAPSHOT + + + + + junit + junit + 4.12 + + + + + + \ No newline at end of file diff --git a/src/main/java/reynoldstitko/gillian/Human.java b/src/main/java/reynoldstitko/gillian/Human.java new file mode 100644 index 0000000..b19cbd1 --- /dev/null +++ b/src/main/java/reynoldstitko/gillian/Human.java @@ -0,0 +1,58 @@ +package reynoldstitko.gillian; + +/** + * Created by gillianreynolds-titko on 1/18/17. + */ +public class Human { + + private String name; + private int age; + private String gender; + private String occupation; + private String address; + + public String getName() { + System.out.println(name); + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + System.out.println(age); + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getGender() { + System.out.println(gender); + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getOccupation() { + System.out.println(occupation); + return occupation; + } + + public void setOccupation(String occupation) { + this.occupation = occupation; + } + + public String getAddress() { + System.out.println(address); + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/src/main/java/reynoldstitko/gillian/Main.java b/src/main/java/reynoldstitko/gillian/Main.java new file mode 100644 index 0000000..5d609ba --- /dev/null +++ b/src/main/java/reynoldstitko/gillian/Main.java @@ -0,0 +1,44 @@ +package reynoldstitko.gillian; + +/** + * Created by gillianreynolds-titko on 1/18/17. + */ +public class Main { + + public static void main(String[] args){ + Human human1 = new Human(); + SuperHuman superhuman1 = new SuperHuman(); + + human1.setName("Ted"); + human1.setAge(25); + human1.setGender("Male"); + human1.setAddress("44 Pine Street, NJ"); + human1.setOccupation("Plumber"); + + superhuman1.setHeroName("Thor"); + superhuman1.setSuperAbility("Lightning"); + superhuman1.setAge(1000); + superhuman1.setAddress("Not of this world"); + superhuman1.setIsGood(false); + superhuman1.setGender("Male"); + superhuman1.setOccupation("God"); + + //Show the Superhuman fields that were set - including fields from the superclass + superhuman1.getHeroName(); + superhuman1.getSuperAbility(); + superhuman1.getIsGood(); + superhuman1.getAge(); + superhuman1.getGender(); + superhuman1.getOccupation(); + superhuman1.getAddress(); + + System.out.println("---------------"); + //Show the Human fields that were set - including some fields from the superclass + human1.getName(); + human1.getAge(); + human1.getAddress(); + human1.getOccupation(); + human1.getGender(); + + } +} diff --git a/src/main/java/reynoldstitko/gillian/SuperHuman.java b/src/main/java/reynoldstitko/gillian/SuperHuman.java new file mode 100644 index 0000000..3010dee --- /dev/null +++ b/src/main/java/reynoldstitko/gillian/SuperHuman.java @@ -0,0 +1,43 @@ +package reynoldstitko.gillian; + +/** + * Created by gillianreynolds-titko on 1/18/17. + */ +public class SuperHuman extends Human { + + private String heroName; + private String superAbility; + private Boolean isGood; + + public Boolean getIsGood() { + if(isGood) + System.out.println("Good"); + else { + System.out.println("Not Good"); + } + return isGood; + } + + public void setIsGood(Boolean isGood) { + this.isGood = isGood; + } + + public String getHeroName() { + System.out.println(heroName); + return heroName; + } + + public void setHeroName(String heroName) { + this.heroName = heroName; + } + + public String getSuperAbility() { + System.out.println(superAbility); + return superAbility; + } + + public void setSuperAbility(String superAbility) { + this.superAbility = superAbility; + } + +}