Skip to content

Reynolds: Human_Superhuman complete #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>reynoldstitko.gillian</groupId>
<artifactId>ReuseClasses</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

</dependencies>


</project>
58 changes: 58 additions & 0 deletions src/main/java/reynoldstitko/gillian/Human.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
44 changes: 44 additions & 0 deletions src/main/java/reynoldstitko/gillian/Main.java
Original file line number Diff line number Diff line change
@@ -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();

}
}
43 changes: 43 additions & 0 deletions src/main/java/reynoldstitko/gillian/SuperHuman.java
Original file line number Diff line number Diff line change
@@ -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;
}

}