You should design a Skyscraper class, with private variables representing the state (i.e., the board configuration) as well as the following methods: - this method should return true if the place- 1. public boolean verifyPlacement() ment is valid (i.e., every row and every column contains each number exactly once.). Otherwise, this method should return false. 2. public void loadPuzzle() in the format specified below. This method must update the relevant instance variables for the object. 3. public void print () lowing the format specified below. 4. public void printWithVisibility() with the visibility scores on the outside. 5. A very simple main method which loads the puzzle from the user, then checks validity and prints the result. If it's valid, it also prints the puzzle with visibility. this method should read a puzzle from standard input - this method should print the puzzle to standard output fol- this method should print the puzzle along

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%

Can you help with the code and explanation comments? 

You should design a Skyscraper class, with private variables representing the state (i.e., the
board configuration) as well as the following methods:
1. public boolean verifyPlacement() – this method should return true if the place-
ment is valid (i.e., every row and every column contains each number exactly once.).
Otherwise, this method should return false.
2. public void loadPuzzle()
in the format specified below. This method must update the relevant instance variables
for the object.
3. public void print()
lowing the format specified below.
4. public void printWithVisibility()
with the visibility scores on the outside.
5. A very simple main method which loads the puzzle from the user, then checks validity
and prints the result. If it's valid, it also prints the puzzle with visibility.
this method should read a puzzle from standard input
this method should print the puzzle to standard output fol-
this method should print the puzzle along
Transcribed Image Text:You should design a Skyscraper class, with private variables representing the state (i.e., the board configuration) as well as the following methods: 1. public boolean verifyPlacement() – this method should return true if the place- ment is valid (i.e., every row and every column contains each number exactly once.). Otherwise, this method should return false. 2. public void loadPuzzle() in the format specified below. This method must update the relevant instance variables for the object. 3. public void print() lowing the format specified below. 4. public void printWithVisibility() with the visibility scores on the outside. 5. A very simple main method which loads the puzzle from the user, then checks validity and prints the result. If it's valid, it also prints the puzzle with visibility. this method should read a puzzle from standard input this method should print the puzzle to standard output fol- this method should print the puzzle along
2.1
Input and Output Format
The loadPuzzle() method reads the configuration from standard input. This is the format
of the input and the required output for basic printing:
1. The first line contains the square dimension of the board, DIM, as a single integer.
2. The remaining DIM lines will each contain exactly DIM positive integers, separated by
a single space, but with no trailing space after the last integer. These lines represent
the heights of the skyscrapers in the same layout as the puzzle.
3. All subsequent lines should be ignored.
For example, the puzzle in Figure 3 is described by the input:
4
4 3 2 1
1 4 3 2
3 2 1 4
2 1 4 3
2.1.1 printWithVisibility Format
The printWithVisibility method should output a graphical representation of the puzzle,
along with the visibility scores calculated according to the rules described earlier.
For the puzzle in Figure 3, the output of this method should be:
1 2 3 3
114 3 2 1|4
2|1 4 3 2|3
213 2 1 4|1
2|2 1 4 3|2
3 3 1 2
2.2 Design and Documentation
You are required to have exactly the public methods described in this document. You are
also encouraged (but not required) to have helper methods. (These may be particularly
helpful when verifying the puzzle and when calculating visibility.) All your helper methods
should be declared private. If you have any class variables, they must be declared private
as well.
Because it complicates grading, you are not allowed to have any package declarations. In-
cluding package declarations in your submission will cause you to lose points.
As with all Java programs, your program filename must match the public class exactly,
therefore your program must be named Skyscraper.java and your class name must be
named Skyscraper.
Transcribed Image Text:2.1 Input and Output Format The loadPuzzle() method reads the configuration from standard input. This is the format of the input and the required output for basic printing: 1. The first line contains the square dimension of the board, DIM, as a single integer. 2. The remaining DIM lines will each contain exactly DIM positive integers, separated by a single space, but with no trailing space after the last integer. These lines represent the heights of the skyscrapers in the same layout as the puzzle. 3. All subsequent lines should be ignored. For example, the puzzle in Figure 3 is described by the input: 4 4 3 2 1 1 4 3 2 3 2 1 4 2 1 4 3 2.1.1 printWithVisibility Format The printWithVisibility method should output a graphical representation of the puzzle, along with the visibility scores calculated according to the rules described earlier. For the puzzle in Figure 3, the output of this method should be: 1 2 3 3 114 3 2 1|4 2|1 4 3 2|3 213 2 1 4|1 2|2 1 4 3|2 3 3 1 2 2.2 Design and Documentation You are required to have exactly the public methods described in this document. You are also encouraged (but not required) to have helper methods. (These may be particularly helpful when verifying the puzzle and when calculating visibility.) All your helper methods should be declared private. If you have any class variables, they must be declared private as well. Because it complicates grading, you are not allowed to have any package declarations. In- cluding package declarations in your submission will cause you to lose points. As with all Java programs, your program filename must match the public class exactly, therefore your program must be named Skyscraper.java and your class name must be named Skyscraper.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Accessibility feature of Form
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