Просмотр исходного кода

Strings in de Routeplanner aangepast

Strings zijn verandert in System.out.println aangezien dit beter bleek te werken dan Strings in de boebot.
aareschluchtje 11 лет назад
Родитель
Сommit
0edfa3c81e
1 измененных файлов с 12 добавлено и 14 удалено
  1. 12 14
      Routeplanner.java

+ 12 - 14
Routeplanner.java

@@ -7,7 +7,6 @@ public class Routeplanner
    private int maxy;
    private int maxy;
    private int ex;
    private int ex;
    private int ey;
    private int ey;
-   public String coordinaten;
    public Routeplanner(int rotation, int maxx, int maxy)
    public Routeplanner(int rotation, int maxx, int maxy)
    {
    {
        this.rotation = rotation;
        this.rotation = rotation;
@@ -53,12 +52,11 @@ public class Routeplanner
            x --;
            x --;
        }
        }
    }
    }
-   public String geefCoordinaten()
+   public void geefCoordinaten()
    {
    {
-       coordinaten = "(" + x + "," + y + ")";
-       return coordinaten;
+       System.out.print("(" + x + "," + y + ")");
    }
    }
-   public String gaNaarPunt(int eindx, int eindy)
+   public void gaNaarPunt(int eindx, int eindy)
    {
    {
        if(eindx <= maxx && eindy <= maxy && eindx >= 0 && eindy >= 0)
        if(eindx <= maxx && eindy <= maxy && eindx >= 0 && eindy >= 0)
        {
        {
@@ -72,12 +70,12 @@ public class Routeplanner
                if(rotation == 90)
                if(rotation == 90)
                {
                {
                    vooruit();
                    vooruit();
-                   System.out.println("vooruit");
+                   System.out.print("vooruit");
                }
                }
                else
                else
                {
                {
                    turnleft();
                    turnleft();
-                   System.out.println("turnleft");
+                   System.out.print("turnleft");
                }
                }
            }
            }
            else
            else
@@ -87,12 +85,12 @@ public class Routeplanner
                    if(rotation == 270)
                    if(rotation == 270)
                    {
                    {
                        vooruit();
                        vooruit();
-                       System.out.println("vooruit");
+                       System.out.print("vooruit");
                    }
                    }
                    else
                    else
                    {
                    {
                        turnleft();
                        turnleft();
-                       System.out.println("turnleft");
+                       System.out.print("turnleft");
                    }
                    }
                }
                }
            }
            }
@@ -104,12 +102,12 @@ public class Routeplanner
                if(rotation == 0)
                if(rotation == 0)
                {
                {
                    vooruit();
                    vooruit();
-                   System.out.println("vooruit");
+                   System.out.print("vooruit");
                }
                }
                else
                else
                {
                {
                    turnright();
                    turnright();
-                   System.out.println("turnright");
+                   System.out.print("turnright");
                }
                }
            }
            }
            else
            else
@@ -119,16 +117,16 @@ public class Routeplanner
                    if(rotation == 180)
                    if(rotation == 180)
                    {
                    {
                        vooruit();
                        vooruit();
-                       System.out.println("vooruit");
+                       System.out.print("vooruit");
                    }
                    }
                    else
                    else
                    {
                    {
                        turnright();
                        turnright();
-                       System.out.println("turnright");
+                       System.out.print("turnright");
                    }
                    }
                }
                }
            }
            }
        }
        }
-       return "bestemming bereikt " + geefCoordinaten();
+       System.out.print("bestemming bereikt " + " (" + x + "," + y + ")");
    }
    }
 }
 }