Advertisement
Guest User

Untitled

a guest
Dec 5th, 2011
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.49 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.    
  4. public class Bug
  5. {  
  6.    
  7.    private int startingPoint;
  8.    private char mrBug;
  9.     private char placeholder;
  10.     private int postition;
  11.     private int matrixLength;
  12.     private int matrixRows;
  13.     private String lineGet;
  14.     private String txtFile;
  15.     private char[][] Data = new char[3][];
  16.    
  17.  
  18.    /**
  19.       Constructs a computer class with title, days, time and room
  20.    */
  21.    public Bug(int initialPosition, char bug, String inputFile)
  22.    {  
  23.      startingPoint = initialPosition;
  24.      mrBug = bug;
  25.       txtFile = inputFile;
  26.    }
  27.    
  28.  
  29.    public void matrixPrinter()
  30.    {  
  31.     System.out.print(Data);
  32.      
  33.    }//End of matrixBuilder Method
  34.    
  35.     public void matrixBuilder()
  36.    {  
  37.         Scanner in = new Scanner(txtFile);
  38.         matrixRows = 0;
  39.         while (in.hasNextLine())
  40.             {
  41.                 lineGet = in.next();
  42.                 matrixLength = lineGet.length();
  43.                 Data[matrixRows] = new char[matrixLength];
  44.                 for(int i = 0; i < matrixLength; i++)
  45.                 {
  46.                     placeholder = lineGet.charAt(i);
  47.                     Data[matrixRows][i]= placeholder;
  48.                    
  49.                 }//End of For
  50.                 matrixRows++;
  51.             }//End of While
  52.         in.close();
  53.    }//End of matrixBuilder Method
  54.    
  55.     /**
  56.       Gets the title
  57.       @return the title
  58.    */
  59.     public void turn()
  60.    {  
  61.         //return title;
  62.      
  63.    }
  64.    
  65.    public void move()
  66.    {  
  67.       // your work here
  68.    }
  69.    
  70.    /**
  71.       Gets Postition
  72.       @return the postition
  73.    */
  74.    public int getPostion()
  75.    {  
  76.     return postition;
  77.  
  78.    }
  79. }
  80.  
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement