Cvičenia: 1. týždeň - riešenia úloh, skupina B

public void stvorec(double dlzkaStrany) {

        for (int i = 0; i < 4; i++) {
                this.step(dlzkaStrany);
                this.turn(90);
        }
}

public void trojuholnik(double dlzkaStrany) {

        for (int i = 0; i < 3; i++) {
                this.step(dlzkaStrany);
                this.turn(120);
        }
}

public void rgbTrojuholnik(double dlzkaStrany) {
        this.setPenWidth(2);

        this.setPenColor(Color.red);
        this.step(dlzkaStrany);
        this.turn(120);

        this.setPenColor(Color.green);
        this.step(dlzkaStrany);
        this.turn(120);

        this.setPenColor(Color.blue);
        this.step(dlzkaStrany);
        this.turn(120);
}