Олимпиадный тренинг

Задача . 34757


Задача

Темы:
 A RightTurningBug behaves like a Bug ( declaration Bug ), except that when it turns, it turns 90 degrees to the right. The declaration for the RightTurningBug class is as follows. 

public class RightTurningBug extends Bug 
 {
  public void turn()
  {
   /* missing implementation */
  }
 } 


 Consider the following suggested replacements for /* missing implementation */.
I. 

int desiredDirection = (getDirection ( ) + Location.RIGHT) % Location.FULL_CIRCLE;

while (getDirection() != desiredDirection)
{
  super.turn();
}

II. 
super.turn();
super.turn();

III. 

setDirection(getDirection() + Location.RIGHT);

Which of the replacements will produce the desired behavior?

(A) I only
(B) II only
(C) I and II only
(D) I and III only
(E) I, II, and III 
 

time 1000 ms
memory 32 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
Комментарий учителя