Complete the Java program given below which searches and dis…
Questions
Cоmplete the Jаvа prоgrаm given belоw which searches and display selected daily weather records. The method should handle invalid input, like empty input (including input with only spaces) and non-numeric input. The program should report each error (can use the same message) with an Alert and abort the processing. You must call the getRecordsWithin() method from the last question and use it properly to receive full credit. Assume the getRecordsWithin() method and all relevant classes work properly, regardless of what you wrote in the last question (i.e. do NOT rewrite implementation of getRecordsWithin() method here. Assume it already exists.). Requirements: Your program should mimic the given sample sessions. Do NOT modify the given code, otherwise you will lose points. Just add code to appropriate places and specify where it should be added (#1, #2, #3 or additional place(s) in the program). No need to add additional GUI components or handle layout. Figure 1. Startup screen. Figure 2-1. A valid search with multiple records returned. Figure 2-2. A valid search with no records. “Your search returned 0 records” is displayed. Figure 3-1. An invalid input: empty input (including inputs with only space characters) Figure 3-2. An invalid input: non-numeric input “6th” Reference: all methods listed here are instance methods unless explicitly noted class java.lang.Stringint length()boolean isEmpty()char charAt(int index) // returns the char value at the specified indexString substring(int from, int to) // returns the substring beginning at index from and ending at index to-1String trim() // returns a string whose value is the calling string object, with all leading and trailing spaces removed class javafx.scene.control.TextField/TextArea String getText()void appendText(String value)void setText(String value) class Integerstatic int parseInt(String s) // throws NumberFormatException class Doublestatic double parseDouble(String s) // throws NumberFormatException Here is the given program: ... // imports not shownpublic class Test extends Application { public static void main(String[] args) { launch(args); } //------------------------ private WeatherReport dwr = new WeatherReport(); private TextField inputField; private TextArea resultArea; // #1 //------------------------ public void start(Stage stage) { BorderPane root = new BorderPane(); root.setPadding(new Insets(10, 10, 10, 10)); Label promptLabel = new Label("Find records with daily highTemp nand lowTemp diff no more than: "); inputField = new TextField(); Button searchButton= new Button("Search"); searchButton.setOnAction(e -> process()); HBox topRow = new HBox(5, promptLabel, inputField, searchButton); root.setTop(topRow); resultArea = new TextArea(); root.setCenter(resultArea); // #2 stage.setScene( new Scene(root) ); stage.setTitle("Weather Report"); stage.show(); } // display an alert with the specified header text and content msg, // and wait for an acknowledgement private void displayAlert(String headerMsg, String msg) { Alert alert = new Alert(AlertType.ERROR, msg); alert.setHeaderText(headerMsg); alert.showAndWait(); } // #3} // end class Test
Cоmplete the Jаvа prоgrаm given belоw which searches and display selected daily weather records. The method should handle invalid input, like empty input (including input with only spaces) and non-numeric input. The program should report each error (can use the same message) with an Alert and abort the processing. You must call the getRecordsWithin() method from the last question and use it properly to receive full credit. Assume the getRecordsWithin() method and all relevant classes work properly, regardless of what you wrote in the last question (i.e. do NOT rewrite implementation of getRecordsWithin() method here. Assume it already exists.). Requirements: Your program should mimic the given sample sessions. Do NOT modify the given code, otherwise you will lose points. Just add code to appropriate places and specify where it should be added (#1, #2, #3 or additional place(s) in the program). No need to add additional GUI components or handle layout. Figure 1. Startup screen. Figure 2-1. A valid search with multiple records returned. Figure 2-2. A valid search with no records. “Your search returned 0 records” is displayed. Figure 3-1. An invalid input: empty input (including inputs with only space characters) Figure 3-2. An invalid input: non-numeric input “6th” Reference: all methods listed here are instance methods unless explicitly noted class java.lang.Stringint length()boolean isEmpty()char charAt(int index) // returns the char value at the specified indexString substring(int from, int to) // returns the substring beginning at index from and ending at index to-1String trim() // returns a string whose value is the calling string object, with all leading and trailing spaces removed class javafx.scene.control.TextField/TextArea String getText()void appendText(String value)void setText(String value) class Integerstatic int parseInt(String s) // throws NumberFormatException class Doublestatic double parseDouble(String s) // throws NumberFormatException Here is the given program: ... // imports not shownpublic class Test extends Application { public static void main(String[] args) { launch(args); } //------------------------ private WeatherReport dwr = new WeatherReport(); private TextField inputField; private TextArea resultArea; // #1 //------------------------ public void start(Stage stage) { BorderPane root = new BorderPane(); root.setPadding(new Insets(10, 10, 10, 10)); Label promptLabel = new Label("Find records with daily highTemp nand lowTemp diff no more than: "); inputField = new TextField(); Button searchButton= new Button("Search"); searchButton.setOnAction(e -> process()); HBox topRow = new HBox(5, promptLabel, inputField, searchButton); root.setTop(topRow); resultArea = new TextArea(); root.setCenter(resultArea); // #2 stage.setScene( new Scene(root) ); stage.setTitle("Weather Report"); stage.show(); } // display an alert with the specified header text and content msg, // and wait for an acknowledgement private void displayAlert(String headerMsg, String msg) { Alert alert = new Alert(AlertType.ERROR, msg); alert.setHeaderText(headerMsg); alert.showAndWait(); } // #3} // end class Test
Cоmplete the Jаvа prоgrаm given belоw which searches and display selected daily weather records. The method should handle invalid input, like empty input (including input with only spaces) and non-numeric input. The program should report each error (can use the same message) with an Alert and abort the processing. You must call the getRecordsWithin() method from the last question and use it properly to receive full credit. Assume the getRecordsWithin() method and all relevant classes work properly, regardless of what you wrote in the last question (i.e. do NOT rewrite implementation of getRecordsWithin() method here. Assume it already exists.). Requirements: Your program should mimic the given sample sessions. Do NOT modify the given code, otherwise you will lose points. Just add code to appropriate places and specify where it should be added (#1, #2, #3 or additional place(s) in the program). No need to add additional GUI components or handle layout. Figure 1. Startup screen. Figure 2-1. A valid search with multiple records returned. Figure 2-2. A valid search with no records. “Your search returned 0 records” is displayed. Figure 3-1. An invalid input: empty input (including inputs with only space characters) Figure 3-2. An invalid input: non-numeric input “6th” Reference: all methods listed here are instance methods unless explicitly noted class java.lang.Stringint length()boolean isEmpty()char charAt(int index) // returns the char value at the specified indexString substring(int from, int to) // returns the substring beginning at index from and ending at index to-1String trim() // returns a string whose value is the calling string object, with all leading and trailing spaces removed class javafx.scene.control.TextField/TextArea String getText()void appendText(String value)void setText(String value) class Integerstatic int parseInt(String s) // throws NumberFormatException class Doublestatic double parseDouble(String s) // throws NumberFormatException Here is the given program: ... // imports not shownpublic class Test extends Application { public static void main(String[] args) { launch(args); } //------------------------ private WeatherReport dwr = new WeatherReport(); private TextField inputField; private TextArea resultArea; // #1 //------------------------ public void start(Stage stage) { BorderPane root = new BorderPane(); root.setPadding(new Insets(10, 10, 10, 10)); Label promptLabel = new Label("Find records with daily highTemp nand lowTemp diff no more than: "); inputField = new TextField(); Button searchButton= new Button("Search"); searchButton.setOnAction(e -> process()); HBox topRow = new HBox(5, promptLabel, inputField, searchButton); root.setTop(topRow); resultArea = new TextArea(); root.setCenter(resultArea); // #2 stage.setScene( new Scene(root) ); stage.setTitle("Weather Report"); stage.show(); } // display an alert with the specified header text and content msg, // and wait for an acknowledgement private void displayAlert(String headerMsg, String msg) { Alert alert = new Alert(AlertType.ERROR, msg); alert.setHeaderText(headerMsg); alert.showAndWait(); } // #3} // end class Test
Cоmplete the Jаvа prоgrаm given belоw which searches and display selected daily weather records. The method should handle invalid input, like empty input (including input with only spaces) and non-numeric input. The program should report each error (can use the same message) with an Alert and abort the processing. You must call the getRecordsWithin() method from the last question and use it properly to receive full credit. Assume the getRecordsWithin() method and all relevant classes work properly, regardless of what you wrote in the last question (i.e. do NOT rewrite implementation of getRecordsWithin() method here. Assume it already exists.). Requirements: Your program should mimic the given sample sessions. Do NOT modify the given code, otherwise you will lose points. Just add code to appropriate places and specify where it should be added (#1, #2, #3 or additional place(s) in the program). No need to add additional GUI components or handle layout. Figure 1. Startup screen. Figure 2-1. A valid search with multiple records returned. Figure 2-2. A valid search with no records. “Your search returned 0 records” is displayed. Figure 3-1. An invalid input: empty input (including inputs with only space characters) Figure 3-2. An invalid input: non-numeric input “6th” Reference: all methods listed here are instance methods unless explicitly noted class java.lang.Stringint length()boolean isEmpty()char charAt(int index) // returns the char value at the specified indexString substring(int from, int to) // returns the substring beginning at index from and ending at index to-1String trim() // returns a string whose value is the calling string object, with all leading and trailing spaces removed class javafx.scene.control.TextField/TextArea String getText()void appendText(String value)void setText(String value) class Integerstatic int parseInt(String s) // throws NumberFormatException class Doublestatic double parseDouble(String s) // throws NumberFormatException Here is the given program: ... // imports not shownpublic class Test extends Application { public static void main(String[] args) { launch(args); } //------------------------ private WeatherReport dwr = new WeatherReport(); private TextField inputField; private TextArea resultArea; // #1 //------------------------ public void start(Stage stage) { BorderPane root = new BorderPane(); root.setPadding(new Insets(10, 10, 10, 10)); Label promptLabel = new Label("Find records with daily highTemp nand lowTemp diff no more than: "); inputField = new TextField(); Button searchButton= new Button("Search"); searchButton.setOnAction(e -> process()); HBox topRow = new HBox(5, promptLabel, inputField, searchButton); root.setTop(topRow); resultArea = new TextArea(); root.setCenter(resultArea); // #2 stage.setScene( new Scene(root) ); stage.setTitle("Weather Report"); stage.show(); } // display an alert with the specified header text and content msg, // and wait for an acknowledgement private void displayAlert(String headerMsg, String msg) { Alert alert = new Alert(AlertType.ERROR, msg); alert.setHeaderText(headerMsg); alert.showAndWait(); } // #3} // end class Test
The оpening pаrаgrаphs оf this stоry introduce Phoenix Jackson and describe the setting of the story. Which stage of narrative structure is this?