Objectives: This assignment will assess your mastery of the following objectives: • Write a functionally correct program
Posted: Fri Jul 08, 2022 6:39 am
As an example, the input file for the above example looks like this: 1233 143214 214323 232141 221432 3312 -Another example that has two skyscrapers (the first one is valid but the second one) 3221 313241 221432 142314 234122 2133 1234 13 1 313241 221432 142313 234122 2133 23➡ 12 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 (n). Based on the second example input file above your output should look like this: 3221 313241 221432 142313 234122 2133 VALID Logout
2133 VALID 3221 313241 221432 142313 234122 2133 NOT VALID 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 three methods as following: Method Description public static int getSkyscrapers(Scanner) public static boolean validateSkyscrapers(int) public static void main(String[] args) Extra Credit: N/A The method use the Scanner parameter passed in the method to read skyscrapers from standard input into 2D array. The method validates the 2D array that read from standard input. The main method will run the workflow of the program. Implementation Guidelines: The program does not compile will receive grade of zero. Place your code in a class named Skyscraper and the class. The class should contain a main method which should do the following for the Skyscraper class: 1. Check for the name of the input file specified as a command line argument. If the file is not there print an error message telling the program user the program must be run using the name of an input file that contains skyscraper information as a command line argument. 2. Open the file 3. Read from the file as long as there is skyscraper information - for each set of skyscraper data do the following: a. Assign the clues and skyscraper heights into at least one two-dimensional array of type int (if you would like to have one
Implementation Guidelines: The program does not compile will receive grade of zero. Place your code in a class named Skyscraper and the class. The class should contain a main method which should do the following for the Skyscraper class: 1. Check for the name of the input file specified as a command line argument. If the file is not there print an error message telling the program user the program must be run using the name of an input file that contains skyscraper information as a command line argument. 2. Open the file 3. Read from the file as long as there is skyscraper information - for each set of skyscraper data do the following: a. Assign the clues and skyscraper heights into at least one two-dimensional array of type int (if you would like to have one array for the clues and another for the skyscraper heights that is fine). b. Pass the information just read to a method called validateSkyscrapers. The method should examine the clues and the skyscraper heights and return true if the heights are valid based on the clues, false otherwise. c. Print the skyscraper clues and heights in the format specified above along with a message about whether the heights are valid (as specified above). The code to do this should be placed in a method printSkyscrapers which is passed whatever data you feel is necessary to print the required information. Note: the method printSkyscrapers is optional to implement. 4. Close the input file. 5. Print a message that says "COMPLETED PROCESSING SKYSCRAPERS (without the quotes) 6. You are welcome to write helper methods to complete the tasks above-modular design is an important part of good software development • Be sure your code follows the naming and coding conventions for the class: 1. Instance fields of a class should be named starting with my Logout 2. Parameters to methods should be named starting with the 3. Parameters to methods should be specified as final 4, Javadoc comments should be used for the class as well as the methods of the class 5. You will lose points for each of these things on every assignment if you do not adhere in the ruler 6. See this document for consifia H