Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA question -- Error I am creating a Snakes and Ladder Game. I am trying to create the game board. This game board is to

JAVA question -- Error

I am creating a Snakes and Ladder Game. I am trying to create the game board. This game board is to display a numbered board from 1-100. It is a 10x10 board.

In my driver class, I have:

public class Play { public static int[][] board = new int[10][10];

public static void main(String[] args) { System.out.println(Board.fillBoard(int[][]));

}

My Board object class is the following:

public class Board { private boolean ladder; private boolean snake; Board(){ snake = false; ladder = false; } public static void fillBoard(int[][] a) { int counter = 1; for (int i = 0; i <= a.length; i++) { for (int j = 0; j <= a[i].length; j++) a[i][j] = counter; counter ++; } }

----

With this code I am getting an error in the : System.out.println(Board.fillBoard(int[][]));

this is located in the driver.

There error says:

The method fillBoard(int[][]) in the type Board is not applicable for the arguments (Class)

---

How can I fix this error to create a numbered board (2d array) that is the dimension 10 X 10.

Please try to solve my error and suggest an alternative more efficient method if one exists (I am a beginner so please keep it in the scope of beginner knowledge if you are also going to suggest )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago