AlternateBalloons.java
/* 
program that will paint 100 red, yellow and orange baloons in the sky. 
it will feature commands 
*/


package npw;

import java.awt.Color;
import java.util.Random;
import painter.SPainter;
import shapes.SCircle;
import shapes.SSquare;


public class AlternateBalloons {

    public static void main(String[] args) {
        SPainter painter = new SPainter("Alternate Balloons", 600, 600);
        paintSky(painter);
        paintBalloons(painter);
    }

    private static void paintSky(SPainter painter){
        painter.setColor(Color.BLUE);
        SSquare sky = new SSquare(2000);
        painter.paint(sky);
    }

    private static void paintBalloons(SPainter painter) {
        int i = 1;
        Color c1 = randomColor();

        Color c2 = randomColor();

        Color c3 = randomColor();

        Color c4 = randomColor();

        Color c5 = randomColor();

        Color c6 = randomColor();

        while ( i <= 300) {

            paintOneBalloon(painter, c1, c2, c3, c4, c5,c6);
            i = i + 1;
        }
    }

    private static void paintOneBalloon(SPainter painter, Color c1, Color c2, Color c3, Color c4, Color c5, Color c6) {
        Random rgen = new Random();

        int rn = rgen.nextInt(6);

        if (rn == 0) {

            painter.setColor(c1);

        } else if (rn ==1) {

            painter.setColor(c2);

        } else if (rn ==2) {

            painter.setColor(c3);

        } else if (rn ==3) {

            painter.setColor(c4);

        } else if (rn ==4) {

            painter.setColor(c5);

        } else if (rn ==5) {

            painter.setColor(c6);

        }

        painter.move();
        SCircle balloon = new SCircle(30);
        painter.paint(balloon);
        painter.setColor(Color.BLACK);
        painter.draw(balloon);
    }

    private static Color randomColor() {

        int rv = (int)(Math.random()*256);

        int gv = (int)(Math.random()*256);

        int bv = (int)(Math.random()*256);

        return new Color(rv,gv,bv);
    }
}