Question: Create a collection class StringCollection for an ArrayList with a method boolean that contains ( string s ) . The contains method iterats over the

Create a collection class StringCollection for an ArrayList with a method boolean that contains(string s). The contains method iterats over the collection and return true if it contains the string s, or false if it not. In addition, you should support Add and Remove, but you can delegate to ArrayList for the implementation.

Did you use inheritance or composition to create your collection class? Why?

Refactor your collection class to use the other type of collection class change from composition to inheritance depending on how the first one is made

Create a builder class to create a Car object. Cars can have GPS, TurbchargedEngine, Color, TransmissionType (automatic or manual), and an optional moonroof. You only need to show the definition of the Car class and the CarBuilder class.

For example, if your car defined a field of type GPS, you dont need to show the GPS class.

Create a program that continuously reads input from the user. The program will read the user input and get a certain type of Animal based on that input. The program should support Dogs, Cats, Bears, Horses, and Cows.

The Animal can then talk. The talking involves printing out to the console, but can say anything.

The animals (Dogs, Cats, Bears, etc.) and their interface will be in one package Zoo and should not be visible outside of the package. Only the Animal interface they all inherit from should be visible from outside the Zoo package.

The main method will be in a separate package. Call this one main.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!