User Tools

Site Tools


stairsweeper

StairSweeper.java

import kareltherobot.Robot;
 
/**
 * Classwork
 * @author (your name)
 * @version (a version number or a date)
 */
 
public class StairSweeper extends Robot
{
 
	public StairSweeper(int street, int avenue, 
                             Direction direction, int beepers) 
        {
		super(street, avenue, direction, beepers);
 
	}
 
	public void climbStair() 
        {
		// code needed here
	}
 
	private void turnRight() 
        {
		//coded needed here
	}
 
}

StairSweeperRunner.java

import kareltherobot.Directions;
import kareltherobot.World;
 
public class StairSweeperRunner implements Directions
{
 
	public static void main(String[] args) 
        {
		String steps = "streets 10\n" + 
				"avenues 10\n" + 
				"beepers 4 4 1\n" + 
				"beepers 3 3 1\n" + 
				"beepers 2 2 1\n" + 
				"eastwestwalls 3 4 4\n" + 
				"eastwestwalls 1 2 2\n" + 
				"eastwestwalls 2 3 3\n" + 
				"northsouthwalls 4 3 3\n" + 
				"northsouthwalls 4 2 2\n" + 
				"northsouthwalls 4 1 1\n" + 
				"northsouthwalls 3 3 3\n" + 
				"northsouthwalls 2 2 2\n" + 
				"northsouthwalls 1 1 1";
		World.getWorld(steps);
		World.setVisible();
                task();
	}
 
	private static void task() 
        {
		StairSweeper alexa = new StairSweeper(1,1, East, 0);
		alexa.climbStair();
		alexa.pickBeeper();
		alexa.turnOff();
 
	}
 
}
stairsweeper.txt · Last modified: 2023/08/22 09:50 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki