Question: JAVA 2 files seprate 1.Staff.java 2.StaffTester.java (provided) Use the following file: StaffTester.java import java.util.ArrayList; /** * Tester */ public class StaffTester { public static void

JAVA

2 files seprate

1.Staff.java

2.StaffTester.java (provided)

JAVA 2 files seprate 1.Staff.java 2.StaffTester.java (provided) Use the following file: StaffTester.java

Use the following file:

StaffTester.java

import java.util.ArrayList; /** * Tester */ public class StaffTester { public static void main(String[] args) { ArrayList list = new ArrayList(); list.add("Goodyear"); list.add("Sathyanantha"); list.add("Keomahavong"); list.add("Addison"); list.add("Smith"); ArrayList list2 = new ArrayList(); list2.add("^aeiouy$"); list2.add("^AEIOUY$"); Staff lister = new Staff(list); Staff lister2 = new Staff(list2); Staff empty = new Staff(new ArrayList()); //test an empty list lister.replaceVowelsWith("*"); System.out.println(lister); System.out.println("Expected: [G**d***r, S*th**n*nth*, K**m*h*v*ng, *dd*s*n, Sm*th]"); lister2.replaceVowelsWith("#"); System.out.println(lister2); System.out.println("Expected: [^######$, ^######$]"); empty.replaceVowelsWith("*"); System.out.println(empty); System.out.println("Expected: []"); //testing equals list.clear(); list.add("Goodyear"); list.add("Sathyanantha"); list.add("Keomahavong"); list.add("Addison"); list.add("Smith"); lister = new Staff(list); list2.clear(); list2.add("Goodyear"); list2.add("Sathyanantha"); list2.add("Keomahavong"); list2.add("Addison"); list2.add("Smith"); lister2 = new Staff(list2); System.out.println("equal?: " + lister.equals(lister2)); System.out.println("Expected: true"); list2.remove(list2.size() - 1); System.out.println("equal?: " + lister.equals(lister2)); System.out.println("Expected: false"); System.out.println("contains?: " + lister.sameContents(lister2)); System.out.println("Expected: false"); list2.add(1, "Smith"); System.out.println("contains?: " + lister.sameContents(lister2)); System.out.println("Expected: true"); list2.set(1, "smith"); System.out.println("equal?: " + lister.equals(lister2)); System.out.println("Expected: false"); System.out.println("equal?: " + empty.equals(empty)); System.out.println("Expected: true"); System.out.println(lister.mostVowels()); System.out.println("Expected: Keomahavong"); list.remove(2); System.out.println(lister.mostVowels()); System.out.println("Expected: Goodyear"); System.out.println(empty.mostVowels()); System.out.println("Expected: null"); } }

Wrte the class staff. It contains methods that manipulate an ArrayList ot Strings representing the names ot statt members. Ihe constructor takes an ArrayList of String names as a parameter. In addition to the constructor, you need to Implement the tollowing metnods The methads publi boolean equals (staff other - Determines If the other staff contains all the same elements in the same order as this staff * public boolean annecontents (Staff other:) -Determines lt the other staff and this start contain exactly the same elements but in any order .public void replaceVowelsHith(String ext) Replaces cach vow clement with the replaccment valuc text. Assume the vowels are aclouyAEIOUY . public string mostvouels) Gcts the staff mcmber whose name has the most owels. If more than one has that number of vowcls, return the first. Rcturn null if the list is empty. Assume the owls are acicuAEIOU el In every ArrayLlst pulic St.ring tostringe astring represent inn using Arrayl ist's toString method Wrte the class staff. It contains methods that manipulate an ArrayList ot Strings representing the names ot statt members. Ihe constructor takes an ArrayList of String names as a parameter. In addition to the constructor, you need to Implement the tollowing metnods The methads publi boolean equals (staff other - Determines If the other staff contains all the same elements in the same order as this staff * public boolean annecontents (Staff other:) -Determines lt the other staff and this start contain exactly the same elements but in any order .public void replaceVowelsHith(String ext) Replaces cach vow clement with the replaccment valuc text. Assume the vowels are aclouyAEIOUY . public string mostvouels) Gcts the staff mcmber whose name has the most owels. If more than one has that number of vowcls, return the first. Rcturn null if the list is empty. Assume the owls are acicuAEIOU el In every ArrayLlst pulic St.ring tostringe astring represent inn using Arrayl ist's toString method

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!