2021 FRQ 1A

public class WordMatch {
    String secret;

    public WordMatch(String secret) {
        this.secret = secret;
    }

    public void scoreGuess(String guess) {
        int counter = 0;

        // for loop for first substring index
        for (int i = 0; i < this.secret.length(); i++){
            // loop for second substring index
            for (int j = i + 1; j < this.secret.length() + 1; j++) {
                // if statement
                if (guess.equals(this.secret.substring(i,j))) {
                    counter++;
                }
            }
        }

        // Returning a point value
        int points = counter * guess.length() * guess.length();
        System.out.println("" + guess + " = " + points);
        // return points;
    }
}

WordMatch game = new WordMatch("mississippi");
game.scoreGuess("i"); game.scoreGuess("iss"); game.scoreGuess("issipp"); game.scoreGuess("mississippi");

WordMatch game = new WordMatch("aaaabb");
game.scoreGuess("a"); game.scoreGuess("aa"); game.scoreGuess("aaa"); game.scoreGuess("aabb"); game.scoreGuess("c");
i = 4
iss = 18
issipp = 36
mississippi = 121
a = 4
aa = 12
aaa = 18
aabb = 16
c = 0

2021 FRQ 3A

public class ClubMembers {
    private ArrayList<MemberInfo> memberList;

    public void addMembers(String[] names, int gradYear) {
        for(name : names) {
            memberList.add(new MemberInfo(name, gradYear, true));
        }
    }
}