Question
Write in Java please: Write a program to confirm if a proposed sudoku solution is correct. The program does not solve the puzzle. Input will
Write in Java please: Write a program to confirm if a proposed sudoku solution is correct. The program does not solve the puzzle. Input will be from a data file. The first line will contain a number T in the range [1,10] as the number of test cases. Each test case will be followed by nine lines which are the rows, and each row contains exactly 9 digits separated by spaces with all digits being [1,9] and no stray or extra characters. For each test case, output to the screen the first line starting with "GRID #T:" and a space with T as the test case number starting with 1 and is followed by either "SOLUTION IS CORRECT" or "NOT A SOLUTION". When the proposed solution is correct, no other details are output. When the proposed solution is not correct, two more lines will be output. The first detail line starts with "ROWS WITH ERRORS:" and a space and either a list of row numbers containing errors or "NONE". The second detail line starts with "COLUMNS WITH ERRORS:" and a space and either a list of column numbers containing errors or "NONE". Display multiple row and column numbers in ascending order separated by single spaces. Each test case is followed by a row containing 12 equal signs "============". Let the user enter the file name from the keyboard. Refer to the sample output below.
Sample Run: Enter the file name: sudoku.txt GRID \#1: SOLUTION IS CORRECT ========== GRID \#2: NOT A SOLUTION ROWS WITH ERRORS: NONE COLUMNS WITH ERRORS: 1457 ========== GRID \#3: NOT A SOLUTION ROWS WITH ERRORS: 27 COLUMNS WITH ERRORS: 35 Puzzle Solution \begin{tabular}{|l|l|l|l|l|l|l|l|l|} \hline & & & 5 & & 2 & & & \\ \hline 7 & 8 & & & & & & 1 & 4 \\ \hline & 2 & & & & & & 5 & \\ \hline & & & & & & & & \\ \hline & & 7 & 1 & & 4 & 3 & & \\ \hline & & 3 & 9 & 5 & 6 & 1 & & \\ \hline 8 & & 1 & 2 & & 5 & 4 & & 3 \\ \hline 9 & & & & & & & & 5 \\ \hline & 5 & & 4 & & 3 & & 7 & \\ \hline \end{tabular} Bold digits are start of puzzle \begin{tabular}{|l|l|l|l|l|l|l|l|l|} \hline 4 & 1 & 6 & 5 & 7 & 2 & 9 & 3 & 8 \\ \hline 7 & 8 & 2 & 6 & 3 & 9 & 2 & 1 & 4 \\ \hline 3 & 2 & 9 & 8 & 4 & 1 & 7 & 5 & 6 \\ \hline 1 & 6 & 8 & 3 & 2 & 7 & 5 & 4 & 9 \\ 5 & 9 & 7 & 1 & 8 & 4 & 3 & 6 & 2 \\ 2 & 4 & 3 & 9 & 5 & 6 & 1 & 8 & 7 \\ \hline 8 & 7 & 1 & 2 & 8 & 5 & 4 & 9 & 3 \\ \hline 9 & 3 & 4 & 7 & 1 & 8 & 6 & 2 & 5 \\ \hline 6 & 5 & 2 & 4 & 9 & 3 & 8 & 7 & 1 \\ \hline \end{tabular}
Step 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