1. Complete the private int[U0 copy0fBoard(int[][] originalBoard) method. In this method, you need to declare a 2D array with the same length of the parameter array originalBoard. Then your code must copy values in the parameter array originalBoard to the array you just created and then return it. 2. Complete the private int[] getTwORanNum(int min, int range) method. In this method, you should generate two random numbers in the range min ~(min range) and put them into a single dimensional array. Then your code must return this array. For example, if the passed value of min is §, the passed value of range is 100, then your code need to generate two random numbers in the range 5 ~ 14.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
I need help with step 1
1. Complete the private int[U] copy0fBoard (int[][] originalBoard)
method. In this method, you need to declare a 2D array with the same length of the
parameter array originalBoard. Then your code must copy values in the parameter
array originalBoard to the array you just created and then return it.
2. Complete the private int[] getTwORanNum(int min, int range) method.
In this method, you should generate two random numbers in the range min ~ (min +
range) and put them into a single dimensional array. Then your code must return this
array. For example, if the passed value of min is 5, the passed value of range is 10, then your
code need to generate two random numbers in the range 5 ~ 14.
Transcribed Image Text:1. Complete the private int[U] copy0fBoard (int[][] originalBoard) method. In this method, you need to declare a 2D array with the same length of the parameter array originalBoard. Then your code must copy values in the parameter array originalBoard to the array you just created and then return it. 2. Complete the private int[] getTwORanNum(int min, int range) method. In this method, you should generate two random numbers in the range min ~ (min + range) and put them into a single dimensional array. Then your code must return this array. For example, if the passed value of min is 5, the passed value of range is 10, then your code need to generate two random numbers in the range 5 ~ 14.
2 HW.ja
import java.util.Arrays;
import java.util.Random;
PAPE
public class Sudoku {
public static final int[J BOARD = {
(4, 3, 5, 8, 7, 6, 1, 2, 9},
{8, 7, 6, 2, 1, 9, 3, 4, 5},
{2, 1, 9, 4, 3, 5, 7, 8, 6},
(5, 2, 3, 6, 4, 7, 8, 9, 1},
{9, 8, 1, 5, 2, 3, 4, 6, 7},
{6, 4, 7, 9, 8, 1, 2, 5, 3},
{7, 5, 4, 1, 6, 8, 9, 3, 2},
{3, 9, 2, 7, 5, 4, 6, 1, 8},
{1, 6, 8, 3, 9, 2, 5, 7, 4}};
22
23
24
25
26
27
public static final int GRID_SIZE = 9;
public static final int SUBGRID_SIZE - 3;
public static final double EMPTYCELL PERCENTAGE = 0.5;
public static final 5tring VALUE= "123456789":
28
29
30
31
private int[) puzzle;
private Random random - new Random();
32
33
34
35
V/ Create a copy of Lhe sudoku board
private int[) copyofBoard(int[][] originalBoard) {
// step 1
V/ copy a the passed 20 array to a new array and then return it
36
37
38
39
40
41
42
/7 provide twd rändom number as an array With length tw.
/ used to hide ome numbers
private int[) getTwokan Num (int min, Int range)
43
449
/ strp 2
77 generate tuo runcom integers in the range min-mintrange
saveLrmina LD array and return it
45
46
47
48
49
/ Hide nome numbers to create puzzle.
public int[l createNewPuzzle(int]U board) {
this puzzle = cupyofBoard(board);
int numofEmptylell = (int) Nath.floor(EMPTYCELL_PERCENTAGE * GRID_STZE * GRID S:
50
51-
52
53
54
|Writable
P Type here to search
esc
%23
3.
W
tab
ps lock
Transcribed Image Text:2 HW.ja import java.util.Arrays; import java.util.Random; PAPE public class Sudoku { public static final int[J BOARD = { (4, 3, 5, 8, 7, 6, 1, 2, 9}, {8, 7, 6, 2, 1, 9, 3, 4, 5}, {2, 1, 9, 4, 3, 5, 7, 8, 6}, (5, 2, 3, 6, 4, 7, 8, 9, 1}, {9, 8, 1, 5, 2, 3, 4, 6, 7}, {6, 4, 7, 9, 8, 1, 2, 5, 3}, {7, 5, 4, 1, 6, 8, 9, 3, 2}, {3, 9, 2, 7, 5, 4, 6, 1, 8}, {1, 6, 8, 3, 9, 2, 5, 7, 4}}; 22 23 24 25 26 27 public static final int GRID_SIZE = 9; public static final int SUBGRID_SIZE - 3; public static final double EMPTYCELL PERCENTAGE = 0.5; public static final 5tring VALUE= "123456789": 28 29 30 31 private int[) puzzle; private Random random - new Random(); 32 33 34 35 V/ Create a copy of Lhe sudoku board private int[) copyofBoard(int[][] originalBoard) { // step 1 V/ copy a the passed 20 array to a new array and then return it 36 37 38 39 40 41 42 /7 provide twd rändom number as an array With length tw. / used to hide ome numbers private int[) getTwokan Num (int min, Int range) 43 449 / strp 2 77 generate tuo runcom integers in the range min-mintrange saveLrmina LD array and return it 45 46 47 48 49 / Hide nome numbers to create puzzle. public int[l createNewPuzzle(int]U board) { this puzzle = cupyofBoard(board); int numofEmptylell = (int) Nath.floor(EMPTYCELL_PERCENTAGE * GRID_STZE * GRID S: 50 51- 52 53 54 |Writable P Type here to search esc %23 3. W tab ps lock
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education