this is an urgent project and i have no idea where to begin, if i could get help this time, and someone send me a tutorials on how to do this stuff and willing to teach me because my teacher fails to teach...i would be ever so grateful.
/*
Fix this program to provide a interactive game for users.
It is incomplete. There are compile-time and intent/logic errors.
JavaDoc (documentation) on Java, the usual becker classes,
and the becker.io classes are available via the course website
for your reference. Good luck and have fun!
*/
import becker.robots.*;
import becker.io.*;
class RemoteControllableRobot extends Robot
{
int previousCommand = 0;
RemoteControllableRobot(City c, int st, int ave, Direction dir, int num)
{
super();
}
public void turnAround()
{
this.turnLeft();
this.turnLeft();
}
public void turnRight()
{
this.turnAround();
this.turnLeft();
}
public void processCommand(int command)
{
if(previousCommand == command)
{
endingComment = " AGAIN!"; // updating the local variable "endingComment"
}
System.out.println("Your input was: " + command + endingComment);
// do the correct action based on the value of command
if(1 = command) // quit
{
System.out.println("Thanks for playing, bye!");
}
else // user asked for an unrecognized command
{
System.out.println("I don't know what the command "+command+" means!");
}
// update previousCommand instance variable
}
}
public class Midterm extends Object
{
public static void main(String[] args)
{
// game setup
City wallville = new City(10, 10);
Wall wall1 = new Wall(wallville, 2, 1, Direction.NORTH);
Wall wall2 = new Wall(wallville, 2, 2, Direction.NORTH);
Wall wall3 = new Wall(wallville, 2, 1, Direction.WEST);
Wall wall4 = new Wall(wallville, 3, 1, Direction.WEST);
Wall wall5 = new Wall(wallville, 3, 1, Direction.SOUTH);
Wall wall6 = new Wall(wallville, 3, 2, Direction.SOUTH);
Wall wall7 = new Wall(wallville, 2, 2, Direction.EAST);
Thing thing1 = new Thing(wallville, 7, 0);
Thing thing2 = new Thing(wallville, 7, 6);
Thing thing3 = new Thing(wallville, 1, 6);
// instanciate remoteBot
RemoteControllableRobot remoteBot = new RemoteControllableRobot(wallville, 7, 0, Direction.EAST, 0);
// continuously get users' input until they decide to quit
TextInput in = new TextInput();
int userInput = 0;
System.out.println("Put all the things in the enclosure.");
System.out.println("Click the Start button to begin the game!");
while( )
{
System.out.println("Please select from the following options:");
System.out.println("1 - quit");
System.out.println("2 - move");
System.out.println("3 - turn left");
System.out.println("4 - turn right");
System.out.println("5 - turn around");
System.out.println("6 - pick up a thing");
System.out.println("7 - put down something");
in.readInt();
in.readLine();
remoteBot.processCommand(userInput);
}
}
}