hi everyone

system.out.println("thank you all for the birthday greeting!!!!!!!!! much appreciated.)

hi james
it has been quite a while. sorry that I had upset u the last time I was here.

I am trying to build a payroll system for a community college in java. and the calculation is off. been busting my head to get it right. try it all how, turn it around, erase it, redo it over and still getting the same result.
so I would like to know when did my calculation went off. here is the program codes that i used;

 double gpay = 0, netpay = 0, tax, hrs, fixedsal = 0, incometax = 0, totdeduct = 0, deduction = 0, healthsurcharge =0;
        int numhrs,  payrate = 0;

        System.out.println("please enter the lecturer id");
        String userid = readin.next();

        System.out.println("please enter your first name");
        String userfirstname = readin.next();

        System.out.println("please enter your last name");
        String userlastname = readin.next();

        System.out.println("how many hours you have worked");
        double hrswrk = readin.nextDouble();

        System.out.println("what is your teaching allowance");
        double teachallow = readin.nextDouble();

        System.out.println("how much is your NIS");
        double nis = readin.nextDouble();

        hrs = (hrswrk * payrate);
        deduction = (fixedsal * 3/100);
        tax =(gpay * incometax) + 33.50 + nis;
        totdeduct = (gpay - netpay);


        System.out.println("the lecturer id number is " + userid);
        System.out.println("the lecturer name is " + userfirstname +  userlastname);
        System.out.println("the hours worked are " + hrswrk);
        System.out.println("the gross pay is" +  gpay);
        System.out.println("the income tax is " + incometax);
        System.out.println("total deduction is " + totdeduct);
        System.out.println("the netpay is " + netpay);
    }

}
here is the output
please enter the lecturer id
P4587S
please enter your first name
peter
please enter your last name
smalls
how many hours you have worked
50
what is your teaching allowance
1400
how much is your NIS
275
the lecturer id number is P4587S
the lecturer name is petersmalls
the hours worked are 50.0
the gross pay is0.0
the income tax is 0.0
total deduction is 0.0
the netpay is 0.0
BUILD SUCCESSFUL (total time: 34 seconds)

Hi - you didn't upset me, so don't worry.

I can't see any code there that calculates a value for gpay, so its value remains at 0. Similarly for netpay and payrate

okay james
and how are you. are you still mad at me

I'm fine. The sun is shining, my wife just bought me a wonderful new guitar, and I'm watching the men's final at Wimbledon. I'm not mad at anybody.

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.