Question: Problem 3 Write a program that reads a list of names and stores them in an Arraylist of type String. After adding the names to

 Problem 3 Write a program that reads a list of names

Problem 3 Write a program that reads a list of names and stores them in an Arraylist of type String. After adding the names to the list(make sure to enter odd and Even names), implement the following two methods: printEvenNames (ArrayList): This method should traverse the list and check if the string found has even length. If so, then print the string, otherwise an OddStringException should be thrown. printOddNames (ArrayList): This method should print all the names stored in the list with odd length in reversed manner. sortlist (ArrayList) : This method should sort the list according to the length of the Strings. (i.e. Maya, Nadine, Christopher) Sample Input Sample Output Please Enter the number of names you want to upload: 4 Please Enter Name 1: Hala Please Enter Name 2: Lara Please Enter Name 3: Youssef Please Enter Name 4: Osama Even names: - Hala -Lara Odd names: - fessuoY -amaso Sorted: (Hala, Lara, Osama, Youssef] Problem 4 Write a Java program that reads a list of Countries and stores them in an ArrayList of type String. After adding the country names to the List, implement the following Instructions: Print The Elements of the List 1 Check if a specific country name is in the List 1 or not (Print :True/False) Remove The Checked element from the list then print the List size Create another List of type String and fill it with country names (Make sure to put some names cross name with the first list elements) Merge the content of List 1 and List 2 to new List 3 and print the List 3 Remove all Element not in Listi and List2 from List 3 and print List 3 Copy the Element of List 1 to List 3 and delete all the Elements that are in List 2 from List 3 and print List 3 Sample Output A list of cities in Listi: [Lebanon, KSA, USA, Germany, Canada) Is Lebanon in Listi? true 4 cities are in Listi now A list of cities in List2: [Lebanon, Australia, Canada, Russia) Cities in Listi or List2: [KSA, USA, Germany, Canada, Lebanon, Australia, Canada, Russia] Countries in Listi and List2: (Canada) Countries in Listi, but not in 2: [KSA, USA, Germany]

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!