-1
私はカメに西、東、北と南を動かす必要があるJavaプログラムを書いていますが、これまでにカメが移動することはありません所望の方向に移動する。gitbashでグレーディングした後のコンパイラエラー
public class Assignment7 {
// TODO - you need to implement this. Move the given turtle to the West, n times
public static void moveTurtleWest(Turtle t, int n)
{
}
// TODO - you need to implement this. Move the given turtle to the East, n times
public static void moveTurtleEast(Turtle t, int n)
{
for(int i=0; i <n;i++){
t.moveEast();
}
// TODO - you need to implement this. Move the given turtle to the North, n times
public static void moveTurtleNorth(Turtle t, int n)
{
for(int i=0; i <n;i++){
t.moveNorth();
}
// TODO - you need to implement this. Move the given turtle to the South, n times
public static void moveTurtleSouth(Turtle t, int n)
{
for(int i=0; i <n;i++){
t.moveSouth();
}
// TODO - you need to implement this. Move the turtle to the asked position, by calling MoveXXX etc
public static void moveTurtleTo(Turtle t, int x, int y)
{
moveTurtleTo(turtle.xPos,turtle.yPos);
}
public static void main(String[] args) {
// you can use this as you wish to test or exercise your function. Not graded.
Turtle t=new Turtle();
moveTurtleTo(t,15,16);
System.out.println(t);
}
}
moveTurtleTo()という名前のメソッド内にmoveTurtleTo()メソッドがあるのはなぜですか?オーバーロードされたメソッドを表示して、Turtleクラスを表示してください – abcOfJavaAndCPP
コンパイラのエラーは望ましくない動作とは異なります。コンパイルエラーを投稿してください。 – efekctive
どうしたらいいですか? – oneirion