Public Static Void Main String Args Creating New Zoo Zoo Lazoo New Zoo Los Angeles Zoo 533 Q37150723

Advanced Java Programming Project 2: Polymorphism, Class Design, Inheritance Assignment: You are to create seven classes that

public static void main(String[] args) {

        //Creating a newZoo.

        Zoo laZoo = newZoo(“Los Angeles Zoo”, “5333 Zoo Dr, Los Angeles, CA 90027”, 133,0);

        //Creating twodifferent Enclosures.

        EnclosurefirstEnclosure = new Enclosure(“Savanna”);

        EnclosuresecondEnclosure = new Enclosure(“River”);

        //Creating ouranimals.

        Zebra zeb = newZebra(“Zebby”);

        Gazelle gaz = newGazelle(“Gaz”);

        Crocodile croc =new Crocodile(“Gena”);

        Lion leo = newLion(“Leo”);

      //Trying to add croc tothe firstEnclosure, but Crocodiles can’t live in the Savannah, soit prints an error      message.

       firstEnclosure.addAnimal(croc);

        //Adding leo tothe first enclosure.

       firstEnclosure.addAnimal(leo);

        //Adding croc tothe second enclosure.

       secondEnclosure.addAnimal(croc);

        //Trying

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.