Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Advanced Java Chapter 8 (Multi-Dimensional Arrays) Declaring, initializing, and displaying the contents of two-dimensional arrays: sample code Modify this code to read a file of

Advanced Java

Chapter 8 (Multi-Dimensional Arrays)

Declaring, initializing, and displaying the contents of two-dimensional arrays:

sample code

Modify this code to read a file of 81 ints into a 9x9 array and display that array.

Modify this code to determine the size of the file, then determine the dimensionality of the (square) array and read values into the file.

Further modify this code to recognize chars as integers, so that we can read files in different bases.

HOMEWORK: Puzzle Reader

This will lead nicely into a Sudoku-solving problem, which we will write after we cover recursion, in the next unit. For now, well just read and display the puzzles (which might be Sudoku or Numbrix or Magic Squares or any of several number-based puzzles).

S1 1 1 x 1 puzzle

S4: 1, 2, 3, and 4 4 x 4 puzzle

S9: 1 9 9 x 9 puzzle (this is the standard Sudoku or Numbrix dimension)

S16: 0 F 16 x 16 puzzle; a base-16 or hex puzzle

S25 0 P 25 x 25 puzzle; a base-25 puzzle

S36: 0 Z 36 x 36 puzzle; a base-36 puzzle

The only values allowed are the digits 0-9 and the chars A-Z / a-z. For the purposes of the homework, any value can be used in any puzzle. We consider only square puzzles. Puzzles that have a number of entries that is a perfect square are processed and displayed; puzzles that do not have a number of entries that is a perfect square are rejected.

Your program is to read the puzzle (each cell is a single char), determine the number of entries, and if that number is a perfect square then display the puzzle as char, and display the puzzle as int. For example, the puzzle to the left would also be displayed as the puzzle to the right.

A 3 B 3 10 3 11 3

1 2 3 4 1 2 3 4

C A F E 12 10 15 14

0 8 2 C 0 8 2 12

This conversion of char to int will be of great use to us in the next unit, when we explore how recursion can be used to solve number puzzles such as Sudoku and Numbrix and Magic Square.

"advance Java"

I needd the hold code please.

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions