SHARE
TWEET

Untitled

a guest Oct 15th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package oefening2;
  2.  
  3.         import javafx.scene.control.TextArea;
  4.         import javafx.scene.control.TextField;
  5.         import javafx.scene.input.MouseEvent;
  6.  
  7. public class Controller {
  8.     public TextField txtKinderen;
  9.     public TextArea txtAntwoord;
  10.     public TextField txtMaandloon;
  11.  
  12.     public void Clicked_Bereken(MouseEvent mouseEvent) {
  13.  
  14.         String sResultaat = "";
  15.         float fKindergeld;
  16.         int iKinderen = Integer.parseInt(txtKinderen.getText());
  17.         float fMaandloon = Float.parseFloat(txtMaandloon.getText());
  18.  
  19.         try {
  20.  
  21.             if (iKinderen < 3)
  22.             {
  23.                 fKindergeld = iKinderen * 25;
  24.             }
  25.             else if (iKinderen < 5){
  26.                 fKindergeld = (float) (iKinderen * 25 + (iKinderen - 2) * 12.5);
  27.             }
  28.             else {
  29.                 fKindergeld = (float) (iKinderen * 25 + (iKinderen - 2) * 12.5 + (iKinderen - 4) * 7.5);
  30.             }
  31.  
  32.             if (fMaandloon <= 500)
  33.             {
  34.                 fKindergeld = fKindergeld + fKindergeld / 100 * 25;
  35.             }
  36.             else if (fMaandloon > 2000){
  37.                 fKindergeld = fKindergeld - fKindergeld / 100 * 25;
  38.             }
  39.  
  40.             sResultaat = iKinderen + " kinderen en " + txtMaandloon.getText() + " maandloon geeft " + fKindergeld + " kindergeld";
  41.         }
  42.  
  43.         finally {
  44.  
  45.             txtAntwoord.setText(sResultaat);
  46.  
  47.         }
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top