Notes

  • Classes have properties and methods
  • Properties store information about each object
    • private and public
  • Methods runs code
  • Getter and setter methods are coded to modify private attributes

Homework

2021 FRQ 1a

public int scoreGuess (String guess){
    int count = 0;
    for (int i = 0; i <= secret.length() - guess.length(); i++) {
        if (secret.substring(i, i + guess.length()). equals(guess)) {
            count++;
        }
    }
    return count * Math.pow(guess.length(), 2);
}

2021 FRQ 3a

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