Wow I'm an idiot, I just saw the problem, how did I not see that for so long. How do I delete threads?

Hello everyone! I have a problem that confuses the hell out of me, when I try to compile my class file I get the "illegal start of expression" error when everything looks normal, can someone help me out please? here's the code:

public class EmployeePayroll {

    private String FN, LN, ID;
    private double HW, PR, GP, NP, pay, netpay;
    private int cat;

    public EmployeePayroll() {
        HW = 0;
        PR = 0;
        GP = 0;
        NP = 0;
        pay = 0;
        netpay = 0;
        cat = 0;
                           }

   public EmployeePayroll(String sFN, String sLN, String sID, double sHW, double sPR) {
       FN = sFN;
       LN = sLN;
       ID = sID;
       HW = sHW;
       PR = sPR;
                                                                           }

   public void Set(String sFN, String sLN, String sID, double sHW, double sPR) {
       FN = sFN;
       LN = sLN;
       ID = sID;
       HW = sHW;
       PR = sPR;
                                                                           }

   public void CalculatePay() {
       if(cat == 1) {
      PR = 55;
                    }
  else if(cat == 2) {
      PR = 30;
                    }
  else if(cat == 3) {
      PR = 25;
                    }
  else if(cat == 4) {
      PR = 20;
                    }

       if(HW >= 39 && <= 43) {
           PR = PR * 1.5;
                             }
       if(HW >= 43) {
           PR = PR * 2;
                    }

       pay = PR * HW;
       netpay = pay / (43 / 100);
                                }
                             }

And here's the error:

J:\Java\EmployeePayroll.java:52: error: illegal start of expression
       if(HW >= 39 && <= 43) {
                      ^

Edit: Just incase this matters, the code isnt complete yet, I just like to test my code as I go.

Recommended Answers

All 2 Replies

YOu can't abbreviate two tests like that. You have to spell it out
if (HW >= 39 && HW <= 43)

Thank you for your answer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.