Auf Thema antworten

Der Schlüssel zu deinem Problem lautet "else if".



If-Anweisung in Java




Versuch es mal so:



[CODE]    Double.parseDouble(txtWeight.getText());

        if (weight < 0 )

        {

            txtStatus.setText("weight has to be positive");   

       } 

      else

      { 

            if    (  ( destinationNo == fares[0] ) || (destinationNo == fares[1] ))

          {

               if (weight<= LOW_WEIGHT)

            

                      if (rbtSameState.isSelected())         

                      {

                            postage = LOW_WEIGHT_SAME_STATE_FEE;

                      }

                 else

                      {

                            postage=LOW_WEIGHT_INTERSTATE_FEE;

                      }         

                    

           }

              else if

           {         

                      if(rbtSameState.isSelected())

                      {

                            postage= HI_WEIGHT_SAME_STATE_FEE;

                      }

                    else

                      {

                            postage=HI_WEIGHT_INTERSTATE_FEE;

                      }

                

            

           }

      }

        txtPostage.setText(postage+"$");[/CODE]



Oben