jeudi 22 septembre 2016

How do I use != in java strings

My java code has a validator that states if d is enter bring up error message if c or s or v are entered do the calculation. How can I construct gender.equalsIgonreCase to include all words and letters that are not c s v?

if ((gender.equalsIgnoreCase("d")) )  { 


             JOptionPane.showMessageDialog(null, "Your did not enter a valid number");}




         boolean genderCheck1 = gender.equalsIgnoreCase("c");

                e = 2;

            pc = ((amount/2.0) );
            o =Math.ceil(pc);
            tnt = o *sax;
            cc = (amount*d);


        boolean genderCheck2 = gender.equalsIgnoreCase("v");

                e = 2;

            pc = ((amount/2.0) );
            o =Math.ceil(pc);
            tnt = o *sax;
            cc = (amount*vla);

         boolean genderCheck3 = gender.equalsIgnoreCase("s");

         e = 2;

         pc = ((amount/2.0) );
         o =Math.ceil(pc);
         tnt = o *sax;
         cc = (amount*strawc);

Aucun commentaire:

Enregistrer un commentaire