/** * CS1322: Programming Assignment #2 - Fall 2002 * * *
* Class Zoo - A class designed to provide a menu for users to interact * with to run the Zoo for P2. This class is provided by CS1322, * for you to modify as needed. * You should add your collaboration statement, to this ident box below, * and place your own @author tag below the one given by the author of * the code given. * Revisions 1.0: September 15th, 2002 * Received class from CS1322 * 1.1: September 28th, 2002 * Finished Coding ** * @author Andrew Hilton * @version Version 1.1, September 28th, 2002 */ import java.io.*; public class Zoo { /** * This variable contains all of the buildings (Aquariums and * Aviaries) that are in this Zoo. */ private ZooBuilding[] myBuildings; /** * This constant specifies the number of buildings in the Zoo. */ private static final int NUM_BUILDINGS=6; /** * This constant is the main menu choice for putting a new animal * into the Zoo. */ private static final int CHOICE_PUT_ANIMAL=1; /** * This constant is the main menu choice for listing the animals * in the Zoo. */ private static final int CHOICE_LIST_ANIMALS=2; /** * This constant is the main menu choice for feeding the animals in * the Zoo. */ private static final int CHOICE_FEED_ANIMALS=3; /** * This constant is the main menu choice for moving the net in one * of the Aviaries. */ private static final int CHOICE_MOVE_NET=4; /** * This constant is the main menu choice for quitting the program. */ private static final int CHOICE_QUIT=0; /** * This constant specifies the String that is printed to display the * main menu. */ private static final String MAIN_MENU= "Main Zoo Control\n" + "----------------\n" + CHOICE_PUT_ANIMAL+".) Put an animal in a building\n" + CHOICE_LIST_ANIMALS+".) List the animals in a building\n" + CHOICE_FEED_ANIMALS+".) Feed the Animals in a building\n" + CHOICE_MOVE_NET+".) Move the net in an aviary\n"+ CHOICE_QUIT+".) Quit\n"+ "\nEnter your choice: "; /** * This constant specifies the animal creation menu choice to make a bat. */ private static final int ANIMAL_BAT=1; /** * This constant specifies the animal creation menu choice to make a bird. */ private static final int ANIMAL_BIRD=2; /** * This constant specifies the animal creation menu choice to make a duck. */ private static final int ANIMAL_DUCK=3; /** * This constant specifies the animal creation menu choice to make a gator. */ private static final int ANIMAL_GATOR=4; /** * This constant specifies the animal creation menu choice to make a * goldfish. */ private static final int ANIMAL_GOLDFISH=5; /** * This constant specifies the animal creation menu choice to make a shark. */ private static final int ANIMAL_SHARK=6; /** * This constant specifies the String that is displayed for the animal * creation menu. */ private static final String ANIMAL_MENU= "Choose an Animal Type:\n"+ "----------------------\n"+ ANIMAL_BAT+".) Bat\n"+ ANIMAL_BIRD+".) Bird\n"+ ANIMAL_DUCK+".) Duck\n"+ ANIMAL_GATOR+".) Gator\n"+ ANIMAL_GOLDFISH+".) Goldfish\n"+ ANIMAL_SHARK+".) Shark\n"+ "\nEnter your choice: "; /** * The default constructor for Zoo. * This constructor initializes myBuildings to be an array of * size NUM_BUILDINGS, then fills it in, alternating between Aviaries * and Aquariums. */ public Zoo() { myBuildings=new ZooBuilding[NUM_BUILDINGS]; for(int i=0;i