Please fix the code to allow it to run and compile sucessfullyFxHistoryController.java:19: error: class FXHistoryController is public, should be declared in a file named FXHistoryController.javapublic class FXHistoryController implements Initializable {FxNyResolutionController.java:72: error: cannot find symbol        historyController.showWindow();  symbol:   method showWindow()  location: variable historyController of type FXHistoryControllerFxNyResolutionController.java:78: error: cannot find symbol        historyController.showWindow();  symbol:   method showWindow()  location: variable historyController of type FXHistoryController // MainApp.java package NewYearsA6; import java.io.IOException; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage primaryStage) { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("FXNyResolution.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); FxNyResolutionController controller = loader.getController(); NyrData nyrData = new NyrData(); controller.setModel(nyrData); primaryStage.setTitle("New Year's Resolutions"); primaryStage.setScene(scene); primaryStage.show(); loader = new FXMLLoader(getClass().getResource("FxHistory.fxml")); root = loader.load(); scene = new Scene(root); FXHistoryController controllerHistory = loader.getController(); controllerHistory.setModel(nyrData); controller.setHistoryController(controllerHistory); final Stage stageHistory = new Stage(); stageHistory.setTitle("History"); stageHistory.setScene(scene); // Uncomment if you want history window to be visible when the application starts // stageHistory.show(); } catch (IOException ex) { System.out.println(ex.getMessage()); System.out.println(ex.getCause()); ex.printStackTrace(); } } public static void main(String[] args) { launch(args); } }// NyrData.java package NewYearsA6; import java.util.ArrayList; import java.util.List; public class NyrData { public interface Listener { void onChange(NyrData nyrData); } private List<Listener> listeners = new ArrayList<>(); private ArrayList<String> unconfirmedResolutions = new ArrayList<>(); private ArrayList<String> confirmedResolutions = new ArrayList<>(); private ArrayList<String> history = new ArrayList<>(); public NyrData() { unconfirmedResolutions.add("start running"); unconfirmedResolutions.add("go to gym"); unconfirmedResolutions.add("8 hours sleep"); unconfirmedResolutions.add("eat healthy"); unconfirmedResolutions.add("be on time"); } public void addListener(Listener listener) { listeners.add(listener); } public void notifyObservers() { listeners.forEach(l -> l.onChange(this)); } public void confirm() { // Implement confirmation logic here notifyObservers(); } public void oops() { // Implement oops logic here notifyObservers(); } public void clearHistory() { history.clear(); notifyObservers(); } public ArrayList<String> getUnconfirmedResolutions() { return unconfirmedResolutions; } public ArrayList<String> getConfirmedResolutions() { return confirmedResolutions; } public ArrayList<String> getHistory() { return history; } }FxNyResolutionController.java needs to be included and rewriten FXHistoryController.java needs to be added to a file

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

Please fix the code to allow it to run and compile sucessfully

FxHistoryController.java:19: error: class FXHistoryController is public, should be declared in a file named FXHistoryController.java

public class FXHistoryController implements Initializable {
FxNyResolutionController.java:72: error: cannot find symbol
        historyController.showWindow();
  symbol:   method showWindow()
  location: variable historyController of type FXHistoryController

FxNyResolutionController.java:78: error: cannot find symbol
        historyController.showWindow();
  symbol:   method showWindow()
  location: variable historyController of type FXHistoryController


// MainApp.java

package NewYearsA6; import java.io.IOException; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage primaryStage) { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("FXNyResolution.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); FxNyResolutionController controller = loader.getController(); NyrData nyrData = new NyrData(); controller.setModel(nyrData); primaryStage.setTitle("New Year's Resolutions"); primaryStage.setScene(scene); primaryStage.show(); loader = new FXMLLoader(getClass().getResource("FxHistory.fxml")); root = loader.load(); scene = new Scene(root); FXHistoryController controllerHistory = loader.getController(); controllerHistory.setModel(nyrData); controller.setHistoryController(controllerHistory); final Stage stageHistory = new Stage(); stageHistory.setTitle("History"); stageHistory.setScene(scene); // Uncomment if you want history window to be visible when the application starts // stageHistory.show(); } catch (IOException ex) { System.out.println(ex.getMessage()); System.out.println(ex.getCause()); ex.printStackTrace(); } } public static void main(String[] args) { launch(args); } }

// NyrData.java package NewYearsA6; import java.util.ArrayList; import java.util.List; public class NyrData { public interface Listener { void onChange(NyrData nyrData); } private List<Listener> listeners = new ArrayList<>(); private ArrayList<String> unconfirmedResolutions = new ArrayList<>(); private ArrayList<String> confirmedResolutions = new ArrayList<>(); private ArrayList<String> history = new ArrayList<>(); public NyrData() { unconfirmedResolutions.add("start running"); unconfirmedResolutions.add("go to gym"); unconfirmedResolutions.add("8 hours sleep"); unconfirmedResolutions.add("eat healthy"); unconfirmedResolutions.add("be on time"); } public void addListener(Listener listener) { listeners.add(listener); } public void notifyObservers() { listeners.forEach(l -> l.onChange(this)); } public void confirm() { // Implement confirmation logic here notifyObservers(); } public void oops() { // Implement oops logic here notifyObservers(); } public void clearHistory() { history.clear(); notifyObservers(); } public ArrayList<String> getUnconfirmedResolutions() { return unconfirmedResolutions; } public ArrayList<String> getConfirmedResolutions() { return confirmedResolutions; } public ArrayList<String> getHistory() { return history; } }

FxNyResolutionController.java needs to be included and rewriten


FXHistoryController.java needs to be added to a file 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
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