Homework Solution


1.

    if (x > 0) {
      print("Hello World!");
    }
  

2.

    if (age > 10) {
      print("hi");
    } else {
      print("Goodbye");
    }
  

3.

    if (passcode == 100) {
      print(passcode);
    } else {
      print("Go away");
    }
  

4.

    int x = 29183;
    int y = 1956;
    print(x * y);
  

Part 2!

1.

    void draw() {
      fill(255, 0, 0);
      if (mousePressed) {
        ellipse(mouseX, mouseY, 10, 10);
      }
    }
  

2.

    int i = 1;
    while (i < 9999) {
      print(i);
      i += 1;
    }
  

3.

    void printTwice(String s) {
      print(s);
      print(s);
    }
  

4.

    void drawBlueCircle() {
      fill(0, 0, 255);
      ellipse(100, 100, 10, 10);
    }
  

I won't be doing all the hard problems, we went over them in class.
Here's the first one though.

1.

      int x = 0;
      while (x < 9999) {
        print(x);
        x += 2;
      }
    

The solution to the final one is available on the reference page.