Question
Need help!! Below is my code by i am getting error in interface stack class. please help me fix it. thank you.. package mazeGame; import
Need help!! Below is my code by i am getting error in interface stack class. please help me fix it.
thank you..
package mazeGame; import java.io.*; import java.util.*; public class mazeGame { static String[][]maze; public static void main(String[] args) { maze=new String[30][30]; maze=fillArray("mazefile.txt"); } public static String[][]fillArray(String file) { maze = new String[30][30]; try{ Scanner sc = new Scanner(new File(file)); for(int row = 0; row
}
public void location() {
System.out.println("Please enter from the Matrix location S."); Scanner StartingPoint = new Scanner(System.in); String index = StartingPoint.nextLine(); String[] indices = index.split(" "); } public String getByte( String arrayValue, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException { //return arrayValue; //placing this statement at the end because they are not reachable because of this
String x = arrayValue; switch (x.charAt(0)) { case '0': //push();//dfine this method to use //S = StartingPoint; // they both are not declared any where System.out.println("S"); break; case '1': //Move();//define this method to use System.out.println("Help, I am trapped"); break; case 'E': //Exit(); System.out.println("I am free"); break;
default: //doSomethingElse(); } return arrayValue; } } interface Stack { void push(Object X); void pop(); Object top(); Object move(); boolean isEmpty();
}
D mazeGame.javaDStack.java 3 1 package mazeGame; 3 public interface Stack H public void push(Object X) 6 if( topofstack + 1 == theArray. length) 7fillArray(); maze [++top0fstack ] = x; 10 11 public void pop() 12 13 if(isEmpty)) 14 throw new UnderflowException "ArrayStack pop"); 15 16 17 18 public Object top 19 20 if( sEmpty()) 21 throw new UnderflowException( "ArrayStack top"); 22 return theArray[topOfStack]; 23 24 25 opOfStack--; 326 2 7Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started