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

Complete the class SpellingWords. A SpellingWords represents the words on multip

ID: 3843265 • Letter: C

Question

Complete the class SpellingWords. A SpellingWords represents the words on multiple spelling tests. Copy the starter class from Codecheck SpellingWords has a constructor that takes a 2d array of a Strings as a parameter. This is provided for you. You will need to copy the starter code from Codecheck. In the 2d array, a row represent all words on a single spelling test. You are to provide methods last() which will return the last element in the last row. longerThan(int value) which counts the number of words in the array that are longer than value

WRITE THE CODE IN JAVA

Use the following file:

SpellingWordsTester.java

Explanation / Answer

import java.util.ArrayList;
import java.util.Arrays;


public class SpellingWords {
   ArrayList<String> list = new ArrayList<String>();
   public SpellingWords(String[][] array1) {
       // TODO Auto-generated constructor stub
       for(String[] temp : array1){
           list.addAll(Arrays.asList(temp));
       }
   }

   public String last() {
       // TODO Auto-generated method stub
       return list.get(list.size()-1);
   }

   public String longerThan(int i) {
       int counter = 0;
       // TODO Auto-generated method stub
       for(String s : list){
           if(s.length() > i)
               counter++;
       }
       return Integer.toString(counter);
   }

}

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