Question: Using the UML diagram for the ArrayList , Square, PointThreeD classes and the specifications below complete the ArrayList class and write the remaining classes. ArrayList

Using the UML diagram for the ArrayList, Square, PointThreeD classes and the specifications below complete the ArrayList class and write the remaining classes.

Using the UML diagram for the ArrayList, Square, PointThreeD classes and the

ArrayList -DEFAULT_SIZE: int -currentltem: int -arList : T +ArrayList() +ArrayList(int size) +additem(T item): boolean PointThreeD Square -xPoint: double -side: double -yPoint: double +Square() -zPoint: double +Square(double s) +PointThreeD() +getArea(): double +PointThreeD(double x, double y, double z) Specifications: 1. Implement the additem() method in the ArrayList class. Hint: ensure you check the bounds and use the current item to keep track of empty slots in the array. If you are able to add an item successfully, the method should return true. Otherwise, it should return false to indicate the addition failed. 2. Implement the toString () method in the ArrayList class that will iterate through all of the elements in the internal array and call each element's toString() method. Hint: Accumulating the results from each call to toString () in a StringBuilder may be useful here. 3. Write the Square and PointThreeD classes according to their UML class diagrams. Ensure they both have a toString() method. 4. Create a Java class called ListApp that will contain a main() method you can use to test ArrayList. 5. With ListApp, instantiate three different lists: a list of Strings, a list of Squares, and a list of Points and fill them will a few of the appropriate object. Example: ArrayList squareList = new ArrayList (); 6. After you create each list, print out the items on in the list by calling the toString () for the list

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 Programming Questions!