Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. /**
  2.  * A tester for the Drunkard class.
  3.  *
  4.  * @author Cannon
  5.  * @date 2/19/2018
  6.  *
  7.  */
  8.  
  9. import java.util.Scanner;
  10.  
  11. public class DrunkardTester {
  12.     public static void main(String[] args) {
  13.  
  14.     Scanner input = new Scanner(System.in);
  15.  
  16.     System.out.println("Please enter the starting avenue integer: ");
  17.     int avenue = input.nextInt();
  18.     System.out.println("Please enter the starting street integer: ");
  19.     int street = input.nextInt();
  20.    
  21.     // make the Drunkard with initial position
  22.     Drunkard ozzy = new Drunkard(avenue,street);
  23.  
  24.     // have him move 100 intersections
  25.     ozzy.fastForward(100);
  26.    
  27.     // get his current location
  28.     String location = ozzy.getLocation();
  29.    
  30.     // get distance from start
  31.     int distance = ozzy.howFar();
  32.  
  33.     System.out.println("Current location: " + location);
  34.     System.out.println("That's " + distance + " blocks from start.");
  35.  
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement