package retirementcalculator;

import java.io.File;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.chart.LineChart;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

/**
 * FXML Controller class
 *
 * @author derekbarrera
 */
public class RetirementCalculatorLayoutController {
        
    //TextArea Variable
    @FXML private TextArea calculationWindow;
    
    //Text input variables
    @FXML private TextField ageField, incomeTaxRateField, retirementAgeField, capGainsTxRateField, preTaxBalanceField,
                            postTaxBalanceField, preTaxContField, postTaxContField, rateOfReturnField;
    @FXML private ProgressIndicator progessIndicatorObject = new ProgressIndicator();
    @FXML private LineChart<Integer,Integer> lineChart;
    final FileChooser fileChooser = new FileChooser();
    
    //Dialog Box
    Stage dialog = new Stage();

    @FXML protected void calculate(ActionEvent event) {
        
         Retirement retirement = new Retirement(Integer.parseInt(ageField.getText()), Double.parseDouble(incomeTaxRateField.getText()), Integer.parseInt(retirementAgeField.getText()), 
                      Double.parseDouble(capGainsTxRateField.getText()), Double.parseDouble(preTaxBalanceField.getText()), Double.parseDouble(postTaxBalanceField.getText()), Double.parseDouble(preTaxContField.getText()), 
                      Double.parseDouble(postTaxContField.getText()), Double.parseDouble(rateOfReturnField.getText()));

        calculationWindow.setText(retirement.calculate(retirement));
    
    }
    
    @FXML protected void progess(){
        
        double current = 0.0;
        current += .112;
       //progessIndicatorObject.setProgress(.112);
        
    }
    
      @FXML protected void save(ActionEvent event){
        
        File file = fileChooser.showOpenDialog(dialog);
        
        if (file != null) {
            
            
            
            
        }
        
    }
      
          @FXML protected void exit(ActionEvent event) {
        
        System.exit(0);
        
    }
    
    @FXML protected void open(ActionEvent event){
        
        File file = fileChooser.showOpenDialog(dialog);
       
        if (file != null) {
            
            
            
            
        }
        
    }
    
    public void initialize(){
    
        ageField.textProperty().addListener((observable, oldValue, newValue) -> {
    
           try{
               ageField.getText();
               calculationWindow.setText("GO YOU!");
           }
           catch(NumberFormatException e){
               
               calculationWindow.setText("NOPE");
           
           }
    
        });
    
    }
}

@@ -45,16 +45,145 @@
 o.File;%0A
+import java.io.FileOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.ObjectOutputStream;%0Aimport java.nio.charset.Charset;%0A
 import j
@@ -2000,26 +2000,24 @@
  %7D%0A    %0A    
-  
 @FXML protec
@@ -2087,36 +2087,36 @@
 fileChooser.show
-Open
+Save
 Dialog(dialog);%0A
@@ -2132,35 +2132,173 @@
         
-if (file != null) %7B
+Save save = new Save(Integer.parseInt(ageField.getText()), Double.parseDouble(incomeTaxRateField.getText()), Integer.parseInt(retirementAgeField.getText()), 
 %0A       
@@ -2294,33 +2294,32 @@
 ), %0A            
-%0A
             %0A   
@@ -2308,38 +2308,222 @@
             
-  %0A           
+Double.parseDouble(capGainsTxRateField.getText()), Double.parseDouble(preTaxBalanceField.getText()), Double.parseDouble(postTaxBalanceField.getText()), Double.parseDouble(preTaxContField.getText()),
  %0A          
@@ -2520,34 +2520,137 @@
             
-%0A
+    
       
-  %7D
+Double.parseDouble(postTaxContField.getText()), Double.parseDouble(rateOfReturnField.getText()), file);
 %0A        %0A  
@@ -2656,30 +2656,24 @@
    %7D%0A      %0A
-      
     @FXML pr

Add Save method