Created
October 21, 2017 21:01
-
-
Save incorelabs/d8323b73c0ad24a8d1cb963430e260ff to your computer and use it in GitHub Desktop.
Robot Run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Robot; | |
import java.util.*; | |
import javax.swing.*; | |
public class RobotRun { | |
// Main entry point for this example | |
public static void main(String args[]) { | |
String numberOfRows = JOptionPane.showInputDialog("Enter the number of rows"); | |
String numberOfColumns = JOptionPane.showInputDialog("Enter the number of columns"); | |
String roomDescription = numberOfRows + " " + numberOfColumns; | |
RobotRoom aNewRoom = new RobotRoom(roomDescription); | |
JOptionPane.showMessageDialog(null, "Where do you want to put the Robot?"); | |
String robotLocationXString = JOptionPane.showInputDialog("Enter a X co-ordinate for the Robot"); | |
int robotLocationX = Integer.parseInt(robotLocationXString); | |
String robotLocationYString = JOptionPane.showInputDialog("Enter a Y co-ordinate for the Robot"); | |
int robotLocationY = Integer.parseInt(robotLocationYString); | |
String directionString = JOptionPane.showInputDialog("Which Direction the Robot should face?\n(0 = NORTH)\n(1 = EAST)\n(2 = SOUTH)\n(3 = WEST)"); | |
int direction = Integer.parseInt(directionString); | |
Robot myRobot = new Robot(robotLocationX, robotLocationY, direction, aNewRoom); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment