Question: use this initial code to complete java code Skyscraper.java import java.io.FileNotFoundException;/** * Reads in configurations of potential solutions to Skyscraper puzzles and * evaluates their

use this initial code to complete java code

Skyscraper.java


import java.io.FileNotFoundException;/** * Reads in configurations of potential solutions to Skyscraper puzzles and * evaluates their validity before printing out both the grids and their status * as an answer to the puzzles.public class Skyscraper{ /** * The driver method to process Skyscraper puzzle settings * The task is to check their validity and then print the grids along with the results of those checks. * * @param theArgs is used for command line input. */ public static void main(final String[] theArgs) throws FileNotFoundException { if (theArgs.length != 1) { System.out.println("ERROR: Program must be run using the name of an input file that " + "contains skyscraper information as a command line argument."); } else { // START FILLING YOUR CODE HERE // END FILLING YOUR CODE HERE System.out.println("COMPLETED PROCESSING SKYSCRAPERS"); } } /** * Prints the Skyscraper puzzle configuration and whether it is valid or not as * a solution. * * @param theGrid is a 2D integer array representing a configuration of * integers as a potential answer to a Skyscraper puzzle. * @param theValidity is a boolean value representing whether the 2D integer * array is an acceptable solution or not. */ public static void printSkyscrapers(final int[][] theGrid, final boolean theValidity) { final StringBuilder sb = new StringBuilder(); for (int row = 0; row 
  • skyscraper_1.txt (small input file)

3 2 2 1

3 13 2 4 1

2 2 1 4 3 2

1 4 2 3 1 3

2 3 4 1 2 2

2 1 3 3

1 2 3 4

3 1 3 2 4 1

2 2 1 4 3 2

1 4 2 3 1 3

2 3 4 1 2 2

2 1 3 3

  • skyscraper_2.txt (big input file)

3 2 4 1

3 2 3 1 4 1

2 34 2 1 3

1 4 1 3 2 3

3 1 2 4 3 2

2 2 1 2

2 1 4 2

2 2 4 1 3 2

3 1 3 2 4 1

1 4 1 3 2 3

2 3 2 4 1 2

2 3 1 3

3 2 2 1

3 1 3 2 4 1

2 2 1 4 3 2

1 4 2 3 1 3

2 3 4 1 2 2

2 1 3 3

2 2 4 1

2 3 2 1 4 1

1 4 1 2 3 2

2 1 4 3 2 3

3 2 3 4 1 2


2 1 3 3

2 2 4 1

2 3 1 2 4 1

2 2 4 3 1 3

3 1 3 4 2 2

4 2 1 2

1 2 3 4

3 1 3 2 4 1

2 2 1 4 3 2

1 4 2 3 1 3

2 3 4 1 2 2

2 1 3 3

2 2 4 1

3 4 2 3 2 1

2 3 3 3 3 2

1 1 1 3 3 3

2 3 2 2 3 2

2 2 1 4

2 1 2 3

2 3 4 2 1 3

3 1 2 4 3 2

1 4 1 3 2 3

2 3 1 3 4 1

2 3 2 1

3 1 2 3

2 2 2 2 3 3

2 2 1 3 2 2

1 3 4 4 2 2

3 1 2 3

4 1 2 2

3 1 1 3 2 3

1 1 2 3 4 3

2 3 2 4 1 2

3 3 3 4 2 1

2 1 2 4 3 2

2 1 3 2


Assignment #1 - Skyscrapers Background: The purpose of this assignment is toreview lectures in 2D-array, nested for loops, file input (scanner). This assignmentwill give you practice working with single and multi- dimensional arrays aswell as basic data structures. The students will also be able todevelop and implement program involving the fundamental programming constructs such as variables,types, expressions, assignment, simple I/O, conditional and iterative control structures, functions and

Assignment #1 - Skyscrapers Background: The purpose of this assignment is to review lectures in 2D-array, nested for loops, file input (scanner). This assignment will give you practice working with single and multi- dimensional arrays as well as basic data structures. The students will also be able to develop and implement program involving the fundamental programming constructs such as variables, types, expressions, assignment, simple I/O, conditional and iterative control structures, functions and parameter passing, structured decomposition. Objectives: This assignment will assess your mastery of the following objectives: o Write a functionally correct program to produce specified console output. Use nested for-loop to check the content in the 2D array. Operate the file I/O (input/output) to read data from and write to file using Scanner class. o Follow prescribed conventions for spacing, indentation, naming methods, and header comments. d

Step by Step Solution

3.34 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This is the code Skyscrapperjava It has a public class named Skyscrapper package MySkyscrapperProject import javaio import javautilScanner public class Skyscrapper int myGrid int myOutsideTop int myOu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!