Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAMMING LANGUAGE!!! : Program Description: You have been given 3 sliding puzzles that are shuffled around. All three puzzles are of different size 3

JAVA PROGRAMMING LANGUAGE!!! :
Program Description: You have been given 3 sliding puzzles that are shuffled around. All three
puzzles are of different size 33,44,55. After you solve all the puzzles you decide you want
to make these puzzles into a program. The puzzles are located in separate files ("33.txt",
"4x4.txt", and "5x5.txt). The program should allow users to choose the puzzle they want to
solve, load the puzzle from the provided files, and solve the puzzle using the console.
Solved Puzzles:
Task 1
Create 2 methods fileReader and puzzleSelector: One will ask the user for which puzzle and a
second which reads the file contents and build a two-dimensional array. Make sure these
methods return the array,
Task 2
Create a print method which prints the array out in its current state. Make sure that it is printed
like the following:
Task 3
Create a method that will check if the puzzle is correctly solved. This can be done by comparing
the array against a solved array. It should return true if solved.
Task 4
Create a method for users to solve the puzzle. It should take in a user input of what piece you
want to slide into the empty slot. It should check if it has been solved after every step. After you
solve it return to the menu.
Task 5
Create a method which prints all unsolved puzzles.
Task 6
Create a menu function that has the following options.
Exit
Print unsolved puzzles
Solve Puzzle
The main() method should only call on the menu () method. All other functionality should come
from method calls. Remember that a method should only do one thing. You should also not write
the same code multiple times, as you can call a method instead.
33.txt
File Edit View
2,3,5,1,4,6,7,8,
44.txt
File Edit View
8,5,7,9,12,11,4,10,3,13,1,15,6,2,14
55.txt
File Edit View
6,21,4,8,1,15,22,7,12,14,13,10,16,11,18,24,23,20,9,17,19,3,2,5,
image text in transcribed

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions