Skip to content
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
21 changes: 21 additions & 0 deletions Zoo/src/AnimalNoise.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

import model.Example;
import model.Parrot;
import model.Cat;
import model.Dog;
import model.Frog;

public class AnimalNoise {

Expand All @@ -16,8 +19,26 @@ public static void main(String[] args) {
// Creating an instance of the Parrot class
Parrot parrot = new Parrot("Green", "Amazon Parrot", 12);

// Creating an instance of the Cat class
Cat cat = new Cat("Brown", "Tabby", 15.5);

// Creating an instance of the Dog class
Dog dog = new Dog("Black", "Black Lab", 60.4);

// Creating an instance of the Frog class
Frog frog = new Frog("Green", "West African Goliath Frog", 7);

// Printing the result of the makeNoise method from the Parrot class
System.out.println(parrot.makeNoise());

// Printing the result of the makeNoise method from the Cat class
System.out.println(cat.makeNoise());

// Printing the result of the makeNoise method from the Dog class
System.out.println(dog.makeNoise());

// Printing the result of the makeNoise method from the Frog class
System.out.println(frog.makeNoise());
}

}
65 changes: 65 additions & 0 deletions Zoo/src/model/Cat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* @author Joshua Vestal-Bennett - javestalbennett
* CIS175 - Fall 2023
* Aug 28, 2023
*/
package model;

/**
*
*/
public class Cat
{
String color;
String species;
double weight; // in pounds

// Constructor
public Cat(String color, String species, double weight)
{
this.color = color;
this.species = species;
this.weight = weight;
}

public String makeNoise()
{
return "Meow";
}

public String getColor()
{
return color;
}

public void setColor(String color)
{
this.color = color;
}

public String getSpecies()
{
return color;
}

public void setSpecies(String species)
{
this.species = species;
}

public double getWeight()
{
return weight;
}

public void setWeight(double weight)
{
this.weight = weight;
}

@Override
public String toString()
{
return "Cat [color=" + color + ", species=" + species + ", weight=" + weight + " pounds]";
}
}
65 changes: 65 additions & 0 deletions Zoo/src/model/Dog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* @author Joshua Vestal-Bennett - javestalbennett
* CIS175 - Fall 2023
* Aug 28, 2023
*/
package model;

/**
*
*/
public class Dog
{
String color;
String species;
double weight;

// Constructor
public Dog(String color, String species, double weight)
{
this.color = color;
this.species = species;
this.weight = weight; // in pounds
}

public String makeNoise()
{
return "Bark";
}

public String getColor()
{
return color;
}

public void setColor(String color)
{
this.color = color;
}

public String getSpecies()
{
return color;
}

public void setSpecies(String species)
{
this.species = species;
}

public double getWeight()
{
return weight;
}

public void setWeight(double weight)
{
this.weight = weight;
}

@Override
public String toString()
{
return "Dog [color=" + color + ", species=" + species + ", weight=" + weight + " pounds]";
}
}
65 changes: 65 additions & 0 deletions Zoo/src/model/Frog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* @author Joshua Vestal-Bennett - javestalbennett
* CIS175 - Fall 2023
* Aug 28, 2023
*/
package model;

/**
*
*/
public class Frog
{
String color;
String species;
double weight;

// Constructor
public Frog(String color, String species, double weight)
{
this.color = color;
this.species = species;
this.weight = weight; // in pounds
}

public String makeNoise()
{
return "Ribbit";
}

public String getColor()
{
return color;
}

public void setColor(String color)
{
this.color = color;
}

public String getSpecies()
{
return color;
}

public void setSpecies(String species)
{
this.species = species;
}

public double getWeight()
{
return weight;
}

public void setWeight(double weight)
{
this.weight = weight;
}

@Override
public String toString()
{
return "Frog [color=" + color + ", species=" + species + ", weight=" + weight + " pounds]";
}
}