SHARE
TWEET

Untitled

a guest Oct 16th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package edu.citytech.salary;
  2.  
  3. import java.util.Scanner;
  4.  
  5. import javafx.fxml.FXML;
  6. import javafx.scene.control.Button;
  7. import javafx.scene.control.Label;
  8. import javafx.scene.layout.BorderPane;
  9. import javafx.scene.control.TextField;
  10. import javafx.scene.input.MouseEvent;
  11. import javafx.scene.layout.AnchorPane;
  12.  
  13.  
  14.  
  15. public class SalaryController {
  16.  
  17.     @FXML
  18.     private AnchorPane ApLayout;
  19.  
  20.     @FXML
  21.     private Label lblWorked;
  22.  
  23.     @FXML
  24.     private Label lblWage;
  25.  
  26.     @FXML
  27.     private TextField InputText1;
  28.  
  29.     @FXML
  30.     private TextField InputText2;
  31.  
  32.     @FXML
  33.     private Button btnCal;
  34.  
  35.     @FXML
  36.     private Button btnReset;
  37.  
  38.     @FXML
  39.     private Label lbltitle;
  40.  
  41.     @FXML
  42.     private BorderPane OutputText;
  43.  
  44.     @FXML
  45.     private Label lblOverITimeHours;
  46.  
  47.     @FXML
  48.     private Label lblInputOvertime;
  49.  
  50.     @FXML
  51.     private Label lblRegHours;
  52.  
  53.     @FXML
  54.     private Label lblInputRegHours;
  55.  
  56.     @FXML
  57.     private Label lblOverTimePay;
  58.  
  59.     @FXML
  60.     private Label lblInputOverTimePay;
  61.  
  62.     @FXML
  63.     private Label lblRegPay;
  64.  
  65.     @FXML
  66.     private Label lblInputRegPay;
  67.  
  68.     @FXML
  69.     private Label lblWeeklyPay;
  70.  
  71.     @FXML
  72.     private Label lblInputWeeklyPay;
  73.  
  74.     @FXML
  75.     private Label lblYearlyPay;
  76.  
  77.     @FXML
  78.     private Label lblInputYearlyPAy;
  79.    
  80.     @FXML
  81.     private Label lblMarginalTax;
  82.  
  83.     @FXML
  84.     private Label lblInputMarginalTax;
  85.  
  86.     @FXML
  87.     private Label lblNetSalary;
  88.  
  89.     @FXML
  90.     private Label lblInputNetSalary;
  91.  
  92.  
  93.     @FXML
  94.     void onMouseClicked(MouseEvent event) {
  95.         int hoursWork =Integer.parseInt(InputText1.getText());
  96.        
  97.         if(hoursWork >= 40) {
  98.          double worked = Integer.parseInt(InputText1.getText());
  99.          double hoursWorked = worked;
  100.          double ans = hoursWorked - 40;
  101.        
  102.          double wage = Integer.parseInt(InputText2.getText());
  103.          double hourWage= wage *1.5*ans;
  104.          double regHours = 40;
  105.          double regPay = 400;
  106.          double weeklyPay = regHours * wage + hourWage;
  107.          double yearlySal = weeklyPay *52;
  108.         if (yearlySal <=9699.999) {
  109.             double tax10=0.10;
  110.             double taxPercentage= tax10 *100;
  111.             double tax = yearlySal *tax10;
  112.             lblMarginalTax.setText("Marginal Tax: ("+taxPercentage+"%)");
  113.             lblInputMarginalTax.setText(Double.toString(tax));
  114.             double netSal= yearlySal-tax;
  115.             lblInputNetSalary.setText("$"+Double.toString(netSal));
  116.         }
  117.         else if (yearlySal >= 9700 && yearlySal<= 39474.999) {
  118.             double tax12=0.12;
  119.             double taxPercentage= tax12 *100;
  120.             double tax = yearlySal *tax12;
  121.             lblMarginalTax.setText("Marginal Tax: ("+taxPercentage+"%)");
  122.             lblInputMarginalTax.setText(Double.toString(tax));
  123.             double netSal= yearlySal-tax;
  124.             lblInputNetSalary.setText("$"+Double.toString(netSal));
  125.         }
  126.         else if (yearlySal >= 39475 && yearlySal<= 84199.999) {
  127.             double tax22=0.22;
  128.             double taxPercentage= tax22 *100;
  129.             double tax = yearlySal *tax22;
  130.             lblMarginalTax.setText("Marginal Tax: ("+taxPercentage+"%)");
  131.             lblInputMarginalTax.setText(Double.toString(tax));
  132.             double netSal= yearlySal-tax;
  133.             lblInputNetSalary.setText("$"+Double.toString(netSal));
  134.         }
  135.         else if (yearlySal >= 84200 && yearlySal<= 160724.999) {
  136.             double tax24=0.24;
  137.             double taxPercentage= tax24 *100;
  138.             double tax = yearlySal *tax24;
  139.             lblMarginalTax.setText("Marginal Tax: ("+taxPercentage+"%)");
  140.             lblInputMarginalTax.setText(Double.toString(tax));
  141.             double netSal= yearlySal-tax;
  142.             lblInputNetSalary.setText("$"+Double.toString(netSal));
  143.         }
  144.         else if (yearlySal >= 160725 && yearlySal<= 204099.999) {
  145.             double tax32=0.32;
  146.             double taxPercentage= tax32 *100;
  147.             double tax = yearlySal *tax32;
  148.             lblMarginalTax.setText("Marginal Tax: ("+taxPercentage+"%)");
  149.             lblInputMarginalTax.setText(Double.toString(tax));
  150.             double netSal= yearlySal-tax;
  151.             lblInputNetSalary.setText("$"+Double.toString(netSal));
  152.         }
  153.         else if (yearlySal >= 204100 && yearlySal<= 510299.999) {
  154.             double tax35=0.35;
  155.             double taxPercentage= tax35 *100;
  156.             double tax = yearlySal *tax35;
  157.             lblMarginalTax.setText("Marginal Tax: ("+taxPercentage+"%)");
  158.             lblInputMarginalTax.setText(Double.toString(tax));
  159.             double netSal= yearlySal-tax;
  160.             lblInputNetSalary.setText("$"+Double.toString(netSal));
  161.         }
  162.         else if (yearlySal >= 9700 && yearlySal<= 39474.999) {
  163.             double tax12=0.12;
  164.             double taxPercentage= tax12 *100;
  165.             double tax = yearlySal *tax12;
  166.             lblMarginalTax.setText("Marginal Tax: ("+taxPercentage+"%)");
  167.             lblInputMarginalTax.setText(Double.toString(tax));
  168.             double netSal= yearlySal-tax;
  169.             lblInputNetSalary.setText("$"+Double.toString(netSal));
  170.         }
  171.        
  172.         }
  173.        
  174.        
  175.            
  176.         }
  177.  
  178.     }
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