Lab 10 (Year 3 Sem 1)

Lab 10 is the eleventh lab in semester 1 of year 3, and the eleventh lab in the total of year 3. It is a lab for arraylist, and is considered to be easy.

Description
No description was provided for this lab.

Unlocked after completion

 * OCD (Score at least 60% for Lab 10: Arraylist)
 * The Dynamic List (Score at least 80% for Lab 10: Arraylist)

Question
The BankAccount class and test program TestBank has been provided. Uncomment and fill in the codes for the missing blanks for the Bank class. After that, write the following methods for the Bank class:  A method named count to count the number of bank accounts whose balance is at least of a given value. Return the number of accounts having at least the given balance.  A method named find to find a bank account with a given account number. It returns null if account number does not exist. The method header is as follows: public BankAccount find(int acctNumber)  A method named largest to get the bank account with the largest balance. This method returns the account number with the largest balance.  

Solution
todo

Question
Write a method named reverseList that will take in an Integer ArrayList, reverse the data in the ArrayList and return the ArrayList. Note that the arraylist you return should be a new copy of the reverse list (i.e. you should not reverse/edit the original arraylist passed in). Write a program named ReverseList that will:  prompt the user to enter a positive integer N, generate an ArrayList of N random integers in range [-50, 50], print the original order of the ArrayList, reverse the data in the ArrayList,</li> print the final order of the ArrayList.</li> </ul> Sample Output: <font face="Courier New">Enter N: 10 <font face="Courier New">Contents of Original Array: <font face="Courier New">22 -9 5 -28 31 35 31 -7 50 25 <font face="Courier New">Contents of Reversed Array: <font face="Courier New">25 50 -7 31 35 31 -28 5 -9 22

Solution
todo

Question
Write a method named getCommonElements that takes in two String ArrayList as parameters and compares the two ArrayList for common elements. If two common elements are found, the element will be copied to a new ArrayList and will be removed from the two ArrayList. The new ArrayList will then be returned by the method. Finally, the method will print out the contents of the two ArrayList and the common elements. Write a program named CommonElements that will use getCommonElements with the inputs used in the sample output below (List A and List B). The program should print out the contents of the two ArrayList before and after removal of common elements as well as the common elements removed. Sample Output: <span style="font-family: &quot;Courier New&quot;;">Original ArrayLists: <span style="font-family: &quot;Courier New&quot;;">List A: [apple, pear, pineapple, melon, durian]  <span style="font-family: &quot;Courier New&quot;;">List B: [strawberry, berry, banana, apple, kiwi, mango, papaya, pear, grapes]  <span style="font-family: &quot;Courier New&quot;;">Final ArrayLists:  <span style="font-family: &quot;Courier New&quot;;">List A: [pineapple, melon, durian]  <span style="font-family: &quot;Courier New&quot;;">List B: [strawberry, berry, banana, kiwi, mango, papaya, grapes]  <span style="font-family: &quot;Courier New&quot;;">Common elements: [apple, pear]

Solution
todo