Advertisement
Guest User

SwitchSsss

a guest
Jan 18th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.90 KB | None | 0 0
  1. private void cbshitActionPerformed(java.awt.event.ActionEvent evt) {                                      
  2.         // TODO add your handling code here:
  3.         String stype = cbshit.getSelectedItem().toString();//declaring it in a variable so it will be easy to call this shit
  4.         double TF = Double.parseDouble(otf.getText());
  5.         double LF = Double.parseDouble(olf.getText());
  6.         double MF = Double.parseDouble(omf.getText());
  7.         double EF = Double.parseDouble(oef.getText());
  8.         double MandanasDiscount[] = {(TF - (TF / 100 * 20)),(LF - (LF / 100 * 20)),(MF - (MF / 100 * 20)),(EF - (EF / 100 * 20))};
  9.         double VilmaDiscount[] = {(TF - (TF / 100 * 15)),(LF - (LF / 100 * 15)),(MF - (MF / 100 * 15)),(EF - (EF / 100 * 15))};
  10.         double PGSDiscount[] = {(TF - (TF / 100 * 10)),(LF - (LF / 100 * 10)),(MF - (MF / 100 * 10)),(EF - (EF / 100 * 10))};
  11.         double SFWDiscount[] = {(TF - (TF / 100 * 5)),(LF - (LF / 100 * 5)),(MF - (MF / 100 * 5)),(EF - (EF / 100 * 5))};
  12.         switch(stype)
  13.         {
  14.             case "Mandanas":
  15.                 if(otf.getText() != "")
  16.                 {
  17.                     if(TF > 0)
  18.                     {
  19.                         ftf.setText("" + MandanasDiscount[0]);
  20.                     }
  21.                     else if(TF < 0)
  22.                     {
  23.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  24.                     }
  25.                     else
  26.                     {
  27.                         ftf.setText("" + TF);
  28.                     }
  29.                 }
  30.                 if(olf.getText() != "")
  31.                 {
  32.                     if(LF > 0)
  33.                     {
  34.                         flf.setText("" + MandanasDiscount[1]);
  35.                     }
  36.                     else if(LF < 0)
  37.                     {
  38.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  39.                     }
  40.                     else
  41.                     {
  42.                         flf.setText("" + LF);
  43.                     }
  44.                 }
  45.                 if(omf.getText() != "")
  46.                 {
  47.                     if(MF > 0)
  48.                     {
  49.                         fmf.setText("" + MandanasDiscount[2]);
  50.                     }
  51.                     else if(MF < 0)
  52.                     {
  53.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  54.                     }
  55.                     else
  56.                     {
  57.                         fmf.setText("" + MF);
  58.                     }
  59.                 }
  60.                 if(oef.getText() != "")
  61.                 {
  62.                     if(EF > 0)
  63.                     {
  64.                         fef.setText("" + MandanasDiscount[3]);
  65.                     }
  66.                     else if(EF < 0)
  67.                     {
  68.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  69.                     }
  70.                     else
  71.                     {
  72.                         fef.setText("" + EF);
  73.                     }
  74.                 }
  75.                 break;
  76.             case "Vilma":
  77.                 if(otf.getText() != "")
  78.                 {
  79.                     if(TF > 0)
  80.                     {
  81.                         ftf.setText("" + VilmaDiscount[0]);
  82.                     }
  83.                     else if(TF < 0)
  84.                     {
  85.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  86.                     }
  87.                     else
  88.                     {
  89.                         ftf.setText("" + TF);
  90.                     }
  91.                 }
  92.                 if(olf.getText() != "")
  93.                 {
  94.                     if(LF > 0)
  95.                     {
  96.                         flf.setText("" + VilmaDiscount[1]);
  97.                     }
  98.                     else if(LF < 0)
  99.                     {
  100.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  101.                     }
  102.                     else
  103.                     {
  104.                         flf.setText("" + LF);
  105.                     }
  106.                 }
  107.                 if(omf.getText() != "")
  108.                 {
  109.                     if(MF > 0)
  110.                     {
  111.                         fmf.setText("" + VilmaDiscount[2]);
  112.                     }
  113.                     else if(MF < 0)
  114.                     {
  115.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  116.                     }
  117.                     else
  118.                     {
  119.                         fmf.setText("" + MF);
  120.                     }
  121.                 }
  122.                 if(oef.getText() != "")
  123.                 {
  124.                     if(EF > 0)
  125.                     {
  126.                         fef.setText("" + VilmaDiscount[3]);
  127.                     }
  128.                     else if(EF < 0)
  129.                     {
  130.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  131.                     }
  132.                     else
  133.                     {
  134.                         fef.setText("" + EF);
  135.                     }
  136.                 }
  137.                 break;
  138.             case "PGS":
  139.                 if(otf.getText() != "")
  140.                 {
  141.                     if(TF > 0)
  142.                     {
  143.                         ftf.setText("" + PGSDiscount[0]);
  144.                     }
  145.                     else if(TF < 0)
  146.                     {
  147.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  148.                     }
  149.                     else
  150.                     {
  151.                         ftf.setText("" + TF);
  152.                     }
  153.                 }
  154.                 if(olf.getText() != "")
  155.                 {
  156.                     if(LF > 0)
  157.                     {
  158.                         flf.setText("" + PGSDiscount[1]);
  159.                     }
  160.                     else if(LF < 0)
  161.                     {
  162.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  163.                     }
  164.                     else
  165.                     {
  166.                         flf.setText("" + LF);
  167.                     }
  168.                 }
  169.                 if(omf.getText() != "")
  170.                 {
  171.                     if(MF > 0)
  172.                     {
  173.                         fmf.setText("" + PGSDiscount[2]);
  174.                     }
  175.                     else if(MF < 0)
  176.                     {
  177.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  178.                     }
  179.                     else
  180.                     {
  181.                         fmf.setText("" + MF);
  182.                     }
  183.                 }
  184.                 if(oef.getText() != "")
  185.                 {
  186.                     if(EF > 0)
  187.                     {
  188.                         fef.setText("" + PGSDiscount[3]);
  189.                     }
  190.                     else if(EF < 0)
  191.                     {
  192.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  193.                     }
  194.                     else
  195.                     {
  196.                         fef.setText("" + EF);
  197.                     }
  198.                 }
  199.                 break;
  200.             case "SFW":
  201.                 if(otf.getText() != "")
  202.                 {
  203.                     if(TF > 0)
  204.                     {
  205.                         ftf.setText("" + SFWDiscount[0]);
  206.                     }
  207.                     else if(TF < 0)
  208.                     {
  209.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  210.                     }
  211.                     else
  212.                     {
  213.                         ftf.setText("" + TF);
  214.                     }
  215.                 }
  216.                 if(olf.getText() != "")
  217.                 {
  218.                     if(LF > 0)
  219.                     {
  220.                         flf.setText("" + SFWDiscount[1]);
  221.                     }
  222.                     else if(LF < 0)
  223.                     {
  224.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  225.                     }
  226.                     else
  227.                     {
  228.                         flf.setText("" + LF);
  229.                     }
  230.                 }
  231.                 if(omf.getText() != "")
  232.                 {
  233.                     if(MF > 0)
  234.                     {
  235.                         fmf.setText("" + SFWDiscount[2]);
  236.                     }
  237.                     else if(MF < 0)
  238.                     {
  239.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  240.                     }
  241.                     else
  242.                     {
  243.                         fmf.setText("" + MF);
  244.                     }
  245.                 }
  246.                 if(oef.getText() != "")
  247.                 {
  248.                     if(EF > 0)
  249.                     {
  250.                         fef.setText("" + SFWDiscount[3]);
  251.                     }
  252.                     else if(EF < 0)
  253.                     {
  254.                         JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
  255.                     }
  256.                     else
  257.                     {
  258.                         fef.setText("" + EF);
  259.                     }
  260.                 }
  261.                 break;
  262.             default:
  263.                 ftf.setText("" + TF);
  264.                 flf.setText("" + LF);
  265.                 fmf.setText("" + MF);
  266.                 fef.setText("" + EF);    
  267.                 break;
  268.          
  269.         }
  270.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement