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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started