Browse Source

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 năm trước cách đây
mục cha
commit
0edfa3c81e
1 tập tin đã thay đổi với 12 bổ sung14 xóa
  1. 12 14
      Routeplanner.java

+ 12 - 14
Routeplanner.java

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