Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer must be in Java and preference for not including BufferedReader You will be writing a program to load a file containing a solved sudoku

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Answer must be in Java and preference for not including BufferedReader

You will be writing a program to load a file containing a solved sudoku puzzle, and verifying it's correctness. The goals of this project are: - Read a file - Input data from a file into a 2-dimensional array - Test the data - Output the results 1) You will need to write a function that will load the file data into a two-dimensional array: public static boolean LoadFile(String filename, int[][] data) This function will return true if the file is read properly. If the file is non-existent, empty, or does not contain the proper amount of data, the function should return false. 2) Write functions that will validate the solution by testing that rows, columns, and boxes contain one (and only one) of each digit. The function should return true if valid and false otherwise. Note: the rows, cols, and boxes start with 1 not 0 . public static boolean TestRow(int[][] data, int row) public static boolean TestColumn(int[][] data, int col) public static boolean Testbox(int[][] data, int box) 3) Write a function that will display the solution on the screen (no spaces, output should be a 9x9 number grid). public static void Display(int[][] data) 4) Write your main ( ) function to do the following: - Prompt for the file name Enter the filename: - If there is an error reading the file, display the message Error reading file. and exit. - Display the solution, e.g. 543678912672195348198342567859761423426853791713924856961537284287419635345286179 - Print the results of validation: Row 3 is invalid. Column 5 is invalid. Box 9 is invalid. or The solution is valid

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 Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions