Question: 2 - Assignment 3: Write a Java program that implements an ArrayList to store a list of countries. The program should: 1.Create an ArrayList (String)

 2 - Assignment 3: Write a Java program that implements an

2 - Assignment 3: Write a Java program that implements an ArrayList to store a list of countries. The program should: 1.Create an ArrayList (String) called "myCountry". 2.Print the original size of the ArrayList. 3.Add five elements to the ArrayList: "Ireland", "UK", "AUS", "USA", and "New Zealand". 4.Print the size of the ArrayList after adding elements. 5.Print the contents of the ArrayList in ascending and descending order. 6. Remove the element "AUS" from the ArrayList. 7.Remove the element at index 2 from the ArrayList. 8.Print the size of the ArrayList. 9.Use the Iterator interface to traverse the ArrayList to show the final content in ArrayList. Show the output of this program? Add a reflection on code too. 3 - Assignment 3: Replace all arrays with Arraylists in Composition and Association lab work (Cars and Passengers example) in week 3, make another new method getPassengerName() and use an iterator to display the total number and names of passengers. Add a reflection on the code. Adding a UML for Car for your remembrance. 2. Car a engine: Engine a passengers: Passenger[] - passengerCount : int - Car() - startEngine() : void - addPassenger(Passenger) : void - getPassengers() : Passenger[]

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!