Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HERE IS THE CODE TO WORK FROM. CODE PROB7A /* * To change this license header, choose License Headers in Project Properties. * To change

image text in transcribed image text in transcribed

HERE IS THE CODE TO WORK FROM. CODE PROB7A

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package prob7a;

/** * */ public class Prob7a {

public static void main(String[] args) { /* int[][] board = { {0, 1, 0, 6, 1, 6, 1}, {0, 1, 6, 8, 6, 0, 1}, {5, 2, 2, 1, 8, 2, 9}, {6, 5, 6, 1, 1, 2, 1}, {6, 9, 6, 2, 1, 9, 1}, {3, 5, 9, 1, 3, 1, 1}, {6, 5, 6, 3, 1, 9, 3}, {1, 3, 6, 1, 9, 0, 7} }; */ java.util.Scanner input = new java.util.Scanner(System.in); System.out.print("Enter the number of rows: "); int numberOfRows = input.nextInt(); System.out.print("Enter the number of columns: "); int numberOfColumns = input.nextInt(); int[][] board = new int[numberOfRows][numberOfColumns]; System.out.println("Enter the array values: "); for (int i = 0; i

public static boolean isConsecutiveFour(int[][] values) { int numberOfRows = values.length; int numberOfColumns = values[0].length;

// Check rows for (int i = 0; i

// Check columns for (int j = 0; j

// Check sub-diagonal (left part) for (int j = 3; j

PROBLEM 7 THE FINAL ADVENTURE PARTI: CHAPTER 8.19 --(Pattern recognition: four consecutive equal numbers) Modify the given project Prob7a that tests whether a two-dimensional array has four consecutive numbers of the same value, either horizontally, vertically, or diagonally. public static boolean isConsecutiveFour(intUU values) It does work as is before your changes. Modify the test method that prompts the user to enter the number of rows and columns of a two-dimensional array and then the data for the array so that the data is entered from a supplied file name containing the values in the array All the values are from 0-9. Display the input array and then: 1) Display true if the array contains four consecutive numbers with the same value. 2) otherwise, display false. Here are some examples of the true cases: 0 1 0 3 16 1 0 1 0 3 1 6 1 0 1 0 3 1 6 1 0 1 0 3 1 6 1 0 1 68 60 1 0 16 86 0 1 0 16 86 0 1 0 16 8 6 0 1 5 6 2 1 8 29 5 5 2 1 8 29 56 2 16 2 9 96 2 1 8 29 6 56 6 19 1 6 56 1 19 1 6 56 1 1 9 1 6 96 1 1 9 1 1 36 1 40 7 1 56 1 40 7 1 36 1 40 7 1 39 1 40 7 3 3 3 3 4 0 7 3 5 3 3 4 0 7 36 3 3 40 7 3 3 3 9 4 0 7 PARTII: CHAPTER 16.30 (Pattern recognition: consecutive four equal numbers0 Write a GUI program to convert your Modified Problem 7a to look something like what is shown in Figure 16.49a-b below Let a file supply the numbers in the text fields in a grid of 6 rows and 7 columns. The user can click the Solve button to highlight a sequence of four equal numbers, if it exists. Initially, for design purposes, the values in the text fields are filled with numbers from 0 to 9 using a random generator make fields editable so you can change then values to test your methods

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_2

Step: 3

blur-text-image_3

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

5 What activities are employed in OD processes?

Answered: 1 week ago