package application;

import java.util.Random;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;

public class MainController{
  @FXML
  private Label label1 = new Label();
  @FXML
  private Label label2 = new Label();
  @FXML
  private TextField input = new TextField();
  @FXML
  private Label score = new Label();
  @FXML
  public Random generator = new Random();
  
  private int calc = 1;
  private int result = 0;
  private int score2 = 0;
  private int incorrect = 0;
  
  @FXML
  private void start(ActionEvent event)
  {
    if (this.calc == 1)
    {
      int number1 = this.generator.nextInt(9999);
      int number2 = this.generator.nextInt(9999);
      
      this.label1.setText(String.valueOf(number1));
      this.label2.setText("+   " + String.valueOf(number2));
      this.calc = 0;
      this.result = (number1 + number2);
    }
    else
    {
      int number1 = this.generator.nextInt(4999) + 5000;
      int number2 = this.generator.nextInt(5000);
      
      this.label1.setText(String.valueOf(number1));
      this.label2.setText("-   " + String.valueOf(number2));
      this.calc = 1;
      this.result = (number1 - number2);
    }
  }
  
  @FXML
  private void correction(ActionEvent event)
  {
    String text = this.input.getText();
    double secondNum = Double.parseDouble(text);
    if (secondNum == this.result)
    {
      this.label1.setText("GOOGJOB!!!");
      this.label2.setText("");
      this.score2 += 1;
      this.score.setText("correct: " + String.valueOf(this.score2) + "Incorrect: " + String.valueOf(this.incorrect));
    }
    else
    {
      this.label1.setText("The answer is");
      this.label2.setText(String.valueOf(this.result));
      this.incorrect += 1;
      this.score.setText("correct: " + String.valueOf(this.score2) + "    Incorrect: " + String.valueOf(this.incorrect));
    }
  }
  
  @FXML
  private void exit(ActionEvent event)
  {
    System.exit(0);
  }
}

@@ -249,32 +249,77 @@
 1 = new Label();
+                         //First Number label
 %0D%0A  @FXML%0D%0A  pri
@@ -342,32 +342,78 @@
 2 = new Label();
+                         //Second Number label
 %0D%0A  @FXML%0D%0A  pri
@@ -451,16 +451,52 @@
 Field();
+                  //Field for answer
 %0D%0A  @FXM
@@ -534,16 +534,50 @@
 Label();
+                          //Score 
 %0D%0A  @FXM
@@ -645,24 +645,105 @@
 nt calc = 1;
+                                       //Variable decides addition or subtraction
 %0D%0A  private 
@@ -860,32 +860,118 @@
 tionEvent event)
+                             //Event -%3E activated when %22Next Number%22 button is pressed
 %0D%0A  %7B%0D%0A    if (t
@@ -1034,32 +1034,82 @@
 r.nextInt(9999);
+                   //1st number randomly generated
 %0D%0A      int numb
@@ -1143,16 +1143,73 @@
 t(9999);
+                   //2nd number randomly generated       
 %0D%0A      
@@ -1253,32 +1253,69 @@
 lueOf(number1));
+                 //display 1st number
 %0D%0A      this.lab
@@ -1352,32 +1352,68 @@
 lueOf(number2));
+        //display '+' and 2nd number
 %0D%0A      this.cal
@@ -1452,32 +1452,104 @@
 ber1 + number2);
+                            //Sets 'result' = sum of 1st and 2nd numbers
 %0D%0A    %7D%0D%0A    els
@@ -1614,16 +1614,97 @@
  + 5000;
+            //1st number randomly generated  (1st number must be larger than 2nd)
 %0D%0A      
@@ -1746,16 +1746,66 @@
 t(5000);
+                   //2nd number randomly generated
 %0D%0A      
@@ -1857,16 +1857,53 @@
 mber1));
+                 //display 1st number
 %0D%0A      
@@ -1956,16 +1956,52 @@
 mber2));
+        //display '-' and 2nd number
 %0D%0A      
@@ -2056,16 +2056,79 @@
 umber2);
+                            //Sets 'result' = 1st - 2nd numbers
 %0D%0A    %7D%0D
@@ -2194,146 +2194,463 @@
 ent)
-%0D%0A  %7B%0D%0A    String text = this.input.getText();%0D%0A    double secondNum = Double.parseDouble(text);%0D%0A    if (secondNum == this.result)%0D%0A    %7B
+                        //Event -%3E activated when %22Correct me%22 button is pressed%0D%0A  %7B%0D%0A    String text = this.input.getText();                             //Gets inputed result%0D%0A    double secondNum = Double.parseDouble(text);%0D%0A    if (secondNum == this.result)                                   //Checks if correct 'result' is equal to inputted result%0D%0A    %7B                                                               //This case is for correct result
 %0D%0A  
@@ -2677,17 +2677,17 @@
 ext(%22GOO
-G
+D
 JOB!!!%22)
@@ -2740,24 +2740,90 @@
 score2 += 1;
+                                             //Sets positive score
 %0D%0A      this
@@ -2945,32 +2945,128 @@
 %0A    else%0D%0A    %7B
+                                                               //This case is for correct result
 %0D%0A      this.lab
@@ -3367,16 +3367,79 @@
 t event)
+                              //Event -%3E Exit button is pressed
 %0D%0A  %7B%0D%0A 

Update MainController.java