Lessons 1-15 Learning

Key Takeaways

  • creating a subclass
    • PainterPlus myPainterPlus = new PainterPlus();
    • subclass is part of a superclass
  • writing methods
    • public void turnRight() {
      • turnLeft();
      • turnLeft();
      • turnLeft();
  • loops
    • public void takeAllPaint() {
      • while (isOnBucket()) {
        • takePaint();
    • while the first statement is true, repeat the next code
  • if statements
    • public void moveSouth() {
      • while (isFacingSouth()) {
        • if (!canMove(“south”)) {
        • move(); }
      • else {
        • turnRight(); }
    • only if first statement is true, perform action, otherwise perform second