2018 ap computer science a free response answers code word checker code example

Example 1: 2018 ap computer science a free response answers wordpair

public WordPairList(String[] words)
{
  allPairs = new ArrayList<WordPair>();

  for(int i = 0; i < words.length; i++)
    for(int j = i + 1; j < words.length; j++)
      allPairs.add(new WordPair(words[i], words[j]));
}

Example 2: 2018 ap computer science a free response answers wordpair

public int numMatches()
{
  int matches = 0;

  for(WordPair wp : allPairs)
    if(wp.getFirst().equals(wp.getSecond()))
      matches++;

  return matches;
}

Tags:

Misc Example