Question: Problem Description please solve as the way as described 1. [40 points] Write the following method that returns a new ArrayList. The new list contains
Problem Description please solve as the way as described
1. [40 points] Write the following method that returns a new ArrayList. The new list contains the non-duplicate elements from the original list. public static ArrayList removeDuplicates(ArrayList list) Write a test program to create an ArrayList, and add a few objects of the same type (Integer, Double, etc) that contain duplicates, to the ArrayList. Then you use the static removeDuplicates method to return you an ArrayList that has already got the duplicates removed.
2. [60 points] Write a recursive method to return the number of uppercase letters in a string. Write a test program that prompts the user to enter a string and displays the number of uppercase letters in the string. Note that writing a non-recursive method will lead to a zero mark.
Hint: you can use Character.isUpperCase() method to check whether a character is uppercase or not. The following example shows what the user will see on the screen: This program calculates the number of uppercase letters in a string. Enter a string: HelloWorld! The number of uppercase letters:2
Notes:
In the above examples, user should provide the information shown in italic. Your program should calculate and display the rest.
Test your program with different inputs.
Make a folder called Assignment1, put only your source codes in that folder, zip the folder and submit the zip file to the Moodle.
Marking Scheme [25 marks] Presentation: Organization, legibility, and readability [25 marks] Style: Descriptive identifier, indentation, bracket placement. [50 marks] Correctness: Program works without bugs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
