Question: Lab 1 Objectives: Familiarity with Eclipse IDE Java syntax, the String class Object oriented programming Task: Just a walk in the park! A Mr. John
Lab 1
Objectives:
Familiarity with Eclipse IDE
Java syntax, the String class
Object oriented programming
Task: Just a walk in the park!
A Mr. John Hammond has asked for some basic software to help manage his theme park. (He says he will "spare no expense", but we'll see..) Version 1.0 of the software will create Java objects to represent the park itself, the zones/areas within the park, and the dinosaurs in each zone. Yes, dinosaurs. With this software, park operators will be able to plan and track dinosaurs in each zone of the park as it develops and opens.
Getting Started
Create a new project in Eclipse, following the lab guidelines. Create the following new Java classes, in the default package: (Use these names exactly!)
Park.java
Zone.java
Dinosaur.java
Lab1.java
Place the Lab1.java class provided here in the same default package within your project. Note that this code will not compile until you have completed the requirements of this lab. There will syntax errors until all dependencies (classes and methods) are implemented. Lab1.java has a main method and will be the class to run our application. Follow the remaining instructions for each class in this lab in order to get your code to compile - do not change the given class.
Park
This class will represent a Park object, which we will define as having:
A name, represented as a String (i.e.: Jurassic Park)
Zones, stored as an array of Zone objects (i.e. Zone[])
A toString() method, which calls upon the toString() method in Zone.java to return as a String all needed information.
An addZone(..) method, which takes as a parameter a Zone object and returns nothing.
This class must have a constructor and getters and setters to accommodate its variables.
Zone
This class will represent a Zone object, which we will define as having:
A name, represented as a String (i.e.: Raptor Zone)
An array of Dinosaur objects.
A toString() method which returns a String representation of all dinosaurs in the zone
An addDinosaur(..) method, which takes as a parameter a Dinosaur object and returns nothing.
This class must have a constructor and getters and setters to accommodate its variables.
Dinosaur
This class will represent a Dinosaur object, which we will define as having:
A name, represented as a String (i.e. Rex)
A type, represented as a String (i.e. Tyrannosaurus)
Whether or not the dino is a vegetarian - very important! This will be represented as a boolean (i.e. false, for Rex)
A toString() method which returns a String representation of the dinosaur
This class must have a constructor and getters and setters to accommodate its variables.
As this lab is meant to review regular arrays in Java, no other data structure may be used to store the objects required. (No ArrayLists are permitted, for example).
Output
Once your code compiles, you will be able to examine the output of your program. The output of your program must match the format of the sample below. This sample is the result of running the Lab1.java class with the given main method.
Welcome to Jurassic Park! ------------------------- Raptor Zone: * Velociraptor - Blue (carnivore) * Velociraptor - Delta (carnivore) * Velociraptor - Echo (carnivore) T-Rex Zone: * Tyrannosaurus - Rex (carnivore) Brachiosaurus Zone: * Apatosaurus - Littlefoot (not carnivore) * Stegosaurus - Spike (not carnivore) * Brachiosaurus - Bob (not carnivore)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
