CS 145 Lecture 8 – Computer as Chef
Agenda
- what ?s
- encapsulation
- methods elsewhere (PureData, Madeup)
- methods in Java
TODO
- Read section 1.4 and chapter 3 through section 3.1. Write 2-3 questions observations down on a 1/4 sheet.
Code
Circler.java
package lecture0921;
import java.util.Random;
public class Circler {
public static void main(String[] args) {
System.out.println("<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">");
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
printCircle();
System.out.println("</svg>");
}
private static void printCircle() {
Random generator = new Random();
int cx = generator.nextInt(1000);
int cy = generator.nextInt(800);
int radius = generator.nextInt(150);
int r = generator.nextInt(256);
int g = generator.nextInt(256);
int b = generator.nextInt(256);
System.out.println(" <circle cx=\"" + cx + "\" cy=\"" + cy + "\" r=\"" + radius + "\" stroke=\"black\" stroke-width=\"2\" fill=\"rgb(" + r + "," + g + "," + b + ")\" />");
}
}
Haiku
I design boxes
A good box makes people think
Think outside the box
A good box makes people think
Think outside the box