Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

!!!I just need the last part which is in bold!!! Objectives: Familiarity with Eclipse IDE Java syntax, the String class Object oriented programming Task: Just

!!!I just need the last part which is in bold!!!

Objectives: Familiarity with Eclipse IDE Java syntax, the String class Object oriented programming Task: Just a walk in the park! 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 and the dinosaurs within. Yes, dinosaurs. With this software, park operators will be able to plan each of the different types of dinosaurs the park contains as it develops and opens. Getting Started Begin by creating a new Java project in Eclipse, named according to the lab guidelines - the project name should be abc123-lab1, where abc123 Create the following new Java classes, in the default package: (Use these names exactly!) Park.java Dinosaur.java - This will be an interface Theropod.java - This will be an abstract class, 1 of 3 types of Dinosaur Sauropod.java - This will be an abstract class, 1 of 3 types of Dinosaur Stegosaur.java - This will be an abstract class, 1 of 3 types of Dinosaur Tyrannosaurus.java - This will be a class, 1 of 2 types of Theropod Velociraptor.java - This will be a class, 1 of 2 types of Theropod Apatosaurus.java - This will be a class, 1 of 2 types of Sauropod Brachiosaurus.java - This will be a class, 1 of 2 types of Sauropod Stegosaurus.java - This will be a class, 1 of 1 types of Stegosaur Note that we will have a few relationships between these classes. A Park contains (has-a) Dinosaurs. There are 3 types of Dinosaurs: Theropods, Sauropods, and Stegosaurs. Velociraptors and Tyrannosaurus are types of Theropod. Apatosaurus and Brachiosaurus are types of Sauropod. Stegosaurus is a type of Stegosaur. Lab1.java Place the given Lab1.java class in the default package within your project. Note that this code will not compile until you have completed the requirements of this lab. There will be 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. 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! - - - - - - - - - - - - - * Theropod: Velociraptor named Blue (carnivore) * Theropod: Velociraptor named Delta (carnivore) * Theropod: Velociraptor named Echo (carnivore) * Theropod: Tyrannosaurus named Rex (carnivore) * Sauropod: Apatosaurus named Littlefoot (not carnivore) * Sauropod: Brachiosaurus named Bob (not carnivore) * Stegosaur: Stegosaurus named Spike (not carnivore) Park.java This class will represent a Park object, which we will define as having: A name, represented as a String (e.g.: Jurassic Park) A max capacity of dinosaurs, represented as an int (e.g. in Lab1.java, the max capacity is set to 10) Dinosaurs, stored as an array of Dinosaur objects (e.g. Dinosaur[]) A toString() method, which calls upon the toString() method in Dinosaur.java to return as a String all needed information (see the output above). An addDino(..) method, which takes as a parameter a Dinosaur object and returns nothing. Dinosaur.java This class will represent a Dinosaur, which we will be an interface. This interface should declare the following methods (for the subclasses to implement): A toString() method which returns a String representation of the dinosaur (see output above) A method isvegetarian (), which takes no parameters and returns a boolean for whether or not the dinosaur is a vegetarian (if not, they eat meat!) A getName() which takes no parameters and returns a String of the dinosaurs name (e.g. Echo) A getType() method which takes no parameters and returns a String of the dinosaurs type (e.g. Theropod - Velociraptor) Theropod, Sauropod, & Stegosaur These classes will be abstract classes, representing the types of dinosaurs in our park. This class should implement the Dinosaur interface and each should have: A name, represented as a String (i.e.: Rex) Whether or not the dino is a vegetarian - very important! This will be represented as a boolean (e.g. false, for Rex, our tyrannosaurus) A constructor which takes in a String name and a boolean for their vegetarian diet and initializes the fields. A toString() method which returns a String representation of the dinosaur by calling upon getter methods. A getType() method, fulfilling the requirements of the super class. An abstract method getSubType(), which takes no parameters and returns a sub type of dinosaur (e.g. Velociraptor). This method should be called by the getType() method. Velociraptor, Tyrannosaurus, Apatosaurus, Brachiosaurus, & Stegosaurus These classes will represent the specific types of dinosaurs which can be added to the park. These should extend their respective abstract class (see Getting Started above for which classes should extend which abstract classes). In addition, they should have: A constructor which takes in a String name and a boolean for their vegetarian diet and calls the constructor in the super class. A getType() method which fulfills the requirements of the super class. Note that these will be very short classes in terms of amount of code. Please note for all classes: Each class must have a constructor and getters & setters to accommodate all of its variables. All classes must have a toString() method 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).

!!!I just need the last part which is in bold!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

6. Are my sources reliable?

Answered: 1 week ago

Question

5. Are my sources compelling?

Answered: 1 week ago