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 * guess.length();
}
public String findBetterGuess(String guess1, String guess2)
{
    if (scoreGuess(guess1) > scoreGuess(guess2))
    {
        return guess1;
    }
    if (scoreGuess(guess2) > scoreGuess(guess1))
    {
        return guess2;
    }
    if (guess1.compareTo(guess2) > 0)
    {
        return guess1;
    }
    return guess2;
}

Notes

  • Classes are blueprints for creating objects
  • Objects are instances within a class
  • Methods: certain set of code that runs a specific task
  • Class attributes are inherited by objects
  • Learned about myPainter in Code.org
  • Non static methods are dot operators