# CSCI A202 - Introduction to Programming (II)

Lecture 7: Simple Graphics and a Geometric Class `Circle`

Here's the code we developed in class on Tuesday.

```yimport java.awt.*;
import BreezyGUI.*;

public class Step1 extends GBFrame {

Color[] colors = { Color.blue,
Color.red,
Color.yellow,
Color.yellow,
Color.blue,
Color.blue};

int[] xCoords = { 230,  40, 120, 120, 210, 320};

int[] yCoords = {  30, 120, 120,  60, 210,  50};

int[] radii   = {  10,  20,  15,  20,  30,  25};

public void paint(Graphics g) {
for (int i = 0; i < radii.length; i++) {
g.setColor(colors[i]);
g.fillOval( xCoords[i],
yCoords[i],
}
}

public static void main(String[] args) {
Frame f = new Step1();
f.setSize(500, 300);
f.setVisible(true);
}
}```
and the object oriented version of it, that includes the definition of class `Circle`
```import java.awt.*;
import BreezyGUI.*;

public class Step2 extends GBFrame {

Color[] colors = { Color.blue,
Color.red,
Color.yellow,
Color.yellow,
Color.blue,
Color.blue};

int[] xCoords = { 230,  40, 120, 120, 210, 320};

int[] yCoords = {  30, 120, 120,  60, 210,  50};

int[] radii   = {  10,  20,  15,  20,  30,  25};

public void paint(Graphics g) {
for (int i = 0; i < radii.length; i++) {
circles[i].draw(g);
}
}

int numberOfCircles = 6;
Circle[] circles = new Circle[numberOfCircles];

Step2() {
for (int i = 0; i < numberOfCircles; i++) {
circles[i] = new Circle( xCoords[i],
yCoords[i],
colors[i]);
}
}

public static void main(String[] args) {
Frame f = new Step2();
f.setSize(500, 300);
f.setVisible(true);
}
}

class Circle {
Color color;
Circle( int xInitially, int yInitially,