From 81159cd5ca470da1f7aa66db43a10db5478e9bbc Mon Sep 17 00:00:00 2001 From: Brendan Jennings Date: Sun, 28 Jan 2024 21:24:32 -0600 Subject: [PATCH] Created Raven Class --- Zoo/bin/.gitignore | 2 ++ Zoo/bin/main/Runner.class | Bin 612 -> 1173 bytes Zoo/bin/model/Example.class | Bin 1751 -> 1495 bytes Zoo/src/main/Runner.java | 7 ++++ Zoo/src/model/Raven.java | 69 ++++++++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+) create mode 100644 Zoo/bin/.gitignore create mode 100644 Zoo/src/model/Raven.java diff --git a/Zoo/bin/.gitignore b/Zoo/bin/.gitignore new file mode 100644 index 0000000..7f870ef --- /dev/null +++ b/Zoo/bin/.gitignore @@ -0,0 +1,2 @@ +/main/ +/model/ diff --git a/Zoo/bin/main/Runner.class b/Zoo/bin/main/Runner.class index 87c83e62b518850c14c2c798e4b5e24d3737cfa9..5bf7cb79846dba0064a2952e28eae534795d28a5 100644 GIT binary patch literal 1173 zcmZuwYg5xu5Iwh0l7{dwJc=S%RJ7$)MMZ6SC@_$ic34dl^DQ%3)be?mXB zGj_%w;E!@Vx9LoU@?|%BvwP0DyL&2ISvu1&jr+1eX@Ok28@&5uxBDnlOkfTR z3g#~i=I~oJv|JsFSmJg48fP>X72AIH13MS8f0pUyRXh+-w3fDDxRMOUNR=y?gTqvN$4uNwN%7Lm}3RzR-mg`J?%cpxX+ zTFcI$d9EG$wV-6}*m9ryqX)7iZ-p6dV-KGYXjzXwT7^-TUeL$q8c=`mBL$Z24ToU>H2KrP#RV^Uu#Vs2kn#X8>bnu56*yu~}}6eut+ GhP{7<;QMg^ delta 157 zcmbQr`Gke*)W2Q(7#J9A8I(41DKbhkGO(vsB<2?6q%tz_`{d@Qq~_?mLIftOG6ylT zPOe~f;pAZ8VBlonVc?p4lvy*>i-8FU85sC>Gl)lSXOQ&K-o_vmz7Z(G#J~j-XJ7`B nyg)sCKvIB#8^{xb=m46*3*>PyurbIn$TKhkp#qT4#GnWOwZRzI diff --git a/Zoo/bin/model/Example.class b/Zoo/bin/model/Example.class index 3375ca82adb3a652bdcf0ed5ef2017d5555f364a..bc3d4818e35d13b66c1414bf26e211cd8c26f1d5 100644 GIT binary patch delta 351 zcmZ{g%}T>i5QWdAP}3MiLs6ksyGS*ytu_AF8U?|HAcDG*;^JyAO*Dz6jpELw8&~E< z6eWU!58w;rZNwYv*3FrZfpg|39*PH*ukZIy02a2Nl}9=nzzkvhg59v1%lvljIOsZl zd*|A5Tf8g7APn!`GOy$ELepm+w-gjnR-s@rp^Azs<_T%m>2SYAs2X8R`rThZL&gFj zQz^LIZwL0Tc`>mp5%R`fY5$+W!nZ;gar|?e_bLUOojCyuEE#JAI!y-GRp`ixY>!>? zgDa=UWo#1U{<2|KntFLk-AnZ*QXp}!`GMkzHv5KB`4wXk=Cqm+!4nZoZMo0cq`xX8 m!g_d^&QF^dg(lpD4djHXf~%q?i7BlSKBV;wiC+Q|wtfJ^Do)z~ delta 603 zcmaJ;%}!H66#mYwrL~k$8lngUN>V64#i}TXm%E{XK!UQs#06n7lu7TUw=+#=B(Un% zt#;!xup_u)!2|dLeG49ea7vrlM&shl`OcZ|{I>>MLy6z_H@5&hcvp!Z7IF_2< zoLqyD+SJ+_TNkyD()#+uB=8DvVt7r+{>c=mGhLD0gq_0MqGWabqTSI7;b(8%F1wR( zN2rrfn(Us|m9I6ouf6ZBRHKjl`JyKKDUTBz_C)O;pURST7kXUX6h#q+2Z5FD@Bj*N ztP+;C&PBBr%FLk>Rq0Va6G~OKzDI#7`O@SwenT7wR#=aY2+3WgWW5*)W2A{;oiO{? z3jQ@z47}W_|5FJAoef|Hga{uq0tZoC-#X{c_y(S^7f3Ju!ZVgJmeCu`0!2}bYn0ULPn0Bdun!2kdN diff --git a/Zoo/src/main/Runner.java b/Zoo/src/main/Runner.java index ed1b309..1e6910f 100644 --- a/Zoo/src/main/Runner.java +++ b/Zoo/src/main/Runner.java @@ -1,6 +1,7 @@ package main; import model.Example; +import model.Raven; // Import the Raven class public class Runner { @@ -13,5 +14,11 @@ private void go() { Example example = new Example(); example.makeNoise(); + // Create a Raven object + Raven raven = new Raven("Mountains", "Common Raven", 24, "Black"); + System.out.println("\nRaven:"); + System.out.println(raven); // Calls the toString() method implicitly + System.out.println("Noise: " + raven.makeNoise()); // Calls the makeNoise() method + } } diff --git a/Zoo/src/model/Raven.java b/Zoo/src/model/Raven.java new file mode 100644 index 0000000..854fb1e --- /dev/null +++ b/Zoo/src/model/Raven.java @@ -0,0 +1,69 @@ +package model; + +public class Raven { + // Private instance variables to store Raven properties + private String habitat; + private String name; + private int length; + private String featherColor; + + // Constructor to initialize Raven object with specified properties + public Raven(String habitat, String name, int length, String featherColor) { + this.habitat = habitat; + this.name = name; + this.length = length; + this.featherColor = featherColor; + } + + // Getter method for habitat + public String getHabitat() { + return habitat; + } + + // Setter method for habitat + public void setHabitat(String habitat) { + this.habitat = habitat; + } + + // Getter method for name + public String getName() { + return name; + } + + // Setter method for name + public void setName(String name) { + this.name = name; + } + + // Getter method for length + public int getLength() { + return length; + } + + // Setter method for length + public void setLength(int length) { + this.length = length; + } + + // Getter method for featherColor + public String getFeatherColor() { + return featherColor; + } + + // Setter method for featherColor + public void setFeatherColor(String featherColor) { + this.featherColor = featherColor; + } + + // Override toString method to provide a string representation of the Raven object + @Override + public String toString() { + return "Raven [name=" + name + ", length=" + length + " inches, habitat=" + habitat + + ", featherColor=" + featherColor + "]"; + } + + // Method to simulate the noise a Raven makes + public String makeNoise() { + return "Caw! Caw!"; + } +} \ No newline at end of file