Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void drawTwosquares(){
- int bigSquare = 20;
- int smallSquare = 10;
- int direction = 90;
- int xPos = 0;
- int yPos = 0;
- lowerPen();
- for(int i = 0; i < 8; i = i +1){
- if (i <= 4){
- movePen(bigSquare, xPos, yPos);
- turnDirection(direction);
- }
- else{
- System.out.println("First Square done");
- xPos = 5;
- yPos = -5;
- movePen(smallSquare, xPos, yPos);
- turnDirection(direction);
- }
- }
- liftPen();
- }
- public static void liftPen(){
- System.out.println("Lifting the pen from the paper");
- }
- public static void lowerPen(){
- System.out.println("Lowering the pen to draw on the paper");
- }
- public static void movePen(int lenght, int xPos, int yPos){
- System.out.println("Pen's starting position is: " + "x=" + xPos + " y=" + yPos + " Moving pen by " + lenght + "cm");
- }
- public static void turnDirection(int degree){
- System.out.println("turning pen by " + degree +"°");
- }
- public static void main(String args[]) {
- drawTwosquares();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement