From d9479d9f2ddde0b1e3a82f38b42942993f291431 Mon Sep 17 00:00:00 2001 From: DickeyT Date: Tue, 23 Jan 2024 18:23:24 -0600 Subject: [PATCH] added penguin class to repo --- Zoo/src/main/Runner.java | 9 +++++- Zoo/src/model/Penguin.java | 59 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 Zoo/src/model/Penguin.java diff --git a/Zoo/src/main/Runner.java b/Zoo/src/main/Runner.java index ed1b309..b220209 100644 --- a/Zoo/src/main/Runner.java +++ b/Zoo/src/main/Runner.java @@ -1,6 +1,7 @@ package main; import model.Example; +import model.Penguin; public class Runner { @@ -11,7 +12,13 @@ public static void main(String[] args) { private void go() { Example example = new Example(); - example.makeNoise(); + System.out.println(example.makeNoise()); + + // Creating an instance of the Penguin class + Penguin penguin = new Penguin("Emperor", "Antarctica", 100); + + // Making the penguin go HONK!!!! + System.out.println(penguin.makeNoise()); } } diff --git a/Zoo/src/model/Penguin.java b/Zoo/src/model/Penguin.java new file mode 100644 index 0000000..9164be9 --- /dev/null +++ b/Zoo/src/model/Penguin.java @@ -0,0 +1,59 @@ +/** + * @author TrevorDickey - tjdickey + * CIS175 - Fall 2023 + * Aug 29, 2023 + */ +package model; + +/** + * + */ +public class Penguin { + // Instance variables representing the species, habitat, and height of the Penguin + private String species; + private String habitat; + private int height; //in centimeters + + public Penguin() { + super(); + } + + public Penguin(String species, String habitat, int height) { + super(); + this.species = species; + this.habitat = habitat; + this.height = height; + } + + public String getSpecies() { + return species; + } + + public void setSpecies(String species) { + this.species = species; + } + + public String getHabitat() { + return habitat; + } + + public void setHabitat(String habitat) { + this.habitat = habitat; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } + + @Override + public String toString() { + return "Penguin [species=" + species + ", habitat=" + habitat + ", height=" + height + " centimeters]"; + } + + public String makeNoise() { + return "The " + species + " Penguin says HONK!";} +}