diff --git a/Pet.java b/Pet.java index e9e075f..a773615 100644 --- a/Pet.java +++ b/Pet.java @@ -21,19 +21,26 @@ public String getSpecies() { // Main method to test the class public static void main(String[] args) { - // Create a Pet object - Pet pet1= new Pet("Buddy", "Dog"); + // Create Pet objects + Pet pet1 = new Pet("Buddy", "Dog"); Pet pet2 = new Pet("Quackers", "Duck"); Pet petHG = new Pet("Waffle", "Cat"); - Pet pet5= new Pet("Joey", "Turtle"); - Pet pet3 = new Pet("Quackers", "Duck"); Pet pet4 = new Pet("Barking", "Human"); + Pet pet5 = new Pet("Joey", "Turtle"); + Pet pet3 = new Pet("Quackers", "Duck"); + // Add a new pet + Pet pet6 = new Pet("Speedy", "Snail"); - // Print the name of the pet + // Print the names of the pets System.out.println("Pet's name is: " + pet1.getName()); System.out.println("The second pet's name is: " + pet2.getName()); System.out.println("The cat's name is: " + petHG.getName()); System.out.println("The fourth pet's name is: " + pet4.getName()); + System.out.println("The snail's name is: " + pet6.getName()); } } + +// What this code does: This code defines a Pet class that represents a pet with two properties: + // 1. name: A String representing the name of the pet. + // 2. species: A String representing the type of species the pet belongs to (e.g., dog, duck, etc.). \ No newline at end of file