Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A Java problem. Write the class Staff . It contains methods that manipulate an A

ID: 3856370 • Letter: A

Question

A Java problem. Write the class Staff. It contains methods that manipulate an ArrayList of Strings representing the names of staff members. The constructor takes an ArrayList of String names as a parameter. In addition to the constructor, you need to implement the following methods

The methods

1. public boolean equals(Staff other) - Determines if the other Staff contains all the same elements in the same order as this Staff
2. public boolean sameContents(Staff other) - Determines if the other Staff and this Staff contain exactly the same elements but in any order
3. public void replaceVowelsWith(String text) Replaces each vowel in every ArrayList element with the replacement value text. Assume the vowels are aeiouyAEIOUY
4. public String mostVowels() Gets the staff member whose name has the most vowels. If more than one has that number of vowels, return the first. Return null if the list is empty. Assume the vowels are aeiouAEIOU
5. public String toString() gets a string represent ion using ArrayList's toString method

---------------------------------------------------------------------------------------------------------------------

Use the following file:

StaffTester.java

Explanation / Answer

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;

public class Staff
{
  
   private int length;

   Staff (ArrayList <String>[])
   {
          
           return (new ArrayList<String>[]);
              
   }

   public boolean equals(Staff other)
   {
   if (this == null && other == null){
return true;
}

if((this == null && other != null)
|| this != null && other == null
|| this.size() != other.size()){
return false;
}
      
   this = new ArrayList<String>(this);
two = new ArrayList<String>(other);   

Collections.sort(this);
Collections.sort(other);
return this.equals(other);
   }
  


   private Object size() {
       // TODO Auto-generated method stub
       return null;
   }

   public void replaceVowelsWith(String text)
   {
       final char vowels[] = {'a', 'e' , 'i', 'o', 'u' , 'y','A', 'E' , 'O' , 'U', 'Y'};
      
       Iterator iterator = this.iterator();
       while(iterator.hasNext())
       {
                      
           String element = (String) iterator.next();
           if(element.contains(vowels));
           {
               this.indexOf(element);
               this.set(element,text);
           }
          
       }
   }
  
   public String mostVowels()
   {
     
final CharSequence vowels = { 'a', 'e', 'i','o' , 'u' , 'A','E', 'I', 'O','U'};
       int index[] =new int[this.length];
           Iterator iterator = this.iterator();
       while(iterator.hasNext())
       {
                      
           String element = (String) iterator.next();
           if(element.contains(vowels));
           {
               Object i = this.indexOf(element);
               index[i]++;
           }
          
           Arrays.sort(index);
          
       }
      
         
      
      
   }

   private Object indexOf(String element) {
       // TODO Auto-generated method stub
       return null;
   }

   private Iterator iterator() {
       // TODO Auto-generated method stub
       return null;
   }
  
}
     
     

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote