Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For each skyscraper read from the input file your program should first print that skyscraper, but with a space before the clues for the columns.

For each skyscraper read from the input file your program should first print that skyscraper, but with a space before the clues for the columns. There should NOT be spaces between any of the clues or skyscraper building heights.
After printing the skyscraper you should print either the word VALID if the clues for that skyscraper were met or the words NOT VALID otherwise. VALID or NOT VALID (ALL CAPS REQUIRED) should occur on the line immediately following the skyscraper and should be followed by a newline/carriage return (
). Based on the second example input file above your output should look like this:
3221
313241
221432
142313
234122
2133
VALID
1234
313241
221432
142313
234122
2133
NOT VALID
COMPLETED PROCESSING SKYSCRAPERS
Note: the first and last line of each skyscraper have a space in front.
In the Skyscraper class, you will need to provide at least four public static methods as following:
Method Description
int[][] getSkyscrapers(Scanner) The public static method use the Scanner parameter passed in the method to read skyscrapers from standard input into 2D array. The array should be 6 x 6, and each corner should be set to 0.
boolean validateSkyscrapers(int[][]) The public static method validates the 2D array that read from standard input.
true if the grid is valid
boolean if the grid is not valid
void printSkyscrapers(int[][] grid, boolean validity) The public static method validates the 2D array that read from standard input.
true if the grid is valid
boolean if the grid is not valid
void main(String[] args) The public static main method will run the workflow of the program.

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

Students also viewed these Databases questions