hi james
remember I told you that i have another program for you to help me with, well here it is
something is wrong again with my calculation.

i have debug it, run through and but still cyah see it.

   double gross_sal , netpay , hrswrked = 0, rate_of_pay = 0;
        double total_deduct = 0, deduction, fixed_sal = 0;
        double loan_interest = 0;

        System.out.println("what is the loan officer id number");
        String idnum = userinput.next();

        System.out.println("please enter loan officer first name");
        String officerfirstname = userinput.next();

        System.out.println("please enter loan officer last name");
        String officerlastname = userinput.next();

        System.out.println("what is loan officer fixed salary");
        double fixedsal = userinput.nextDouble();

        System.out.println("please enter total interest in all loans issued month");
        loan_interest = userinput.nextDouble();

        System.out.println("loan officer NIS contribution");
        double NIS = userinput.nextDouble();

        double hrs = (hrswrked * rate_of_pay);
        gross_sal = fixed_sal -(0.3 * loan_interest);
        deduction = (8.50 + NIS + loan_interest);
        netpay= (gross_sal - total_deduct);

        System.out.println("loan officer payslip");

        System.out.println("the loan officer id is  " + idnum);
        System.out.println("the loan officer first name is " + officerfirstname + "\t"+ officerlastname);
        System.out.println("the loan officer total deduction is: $" + total_deduct);
        System.out.println("the loan officer gross pay is:$ " + gross_sal);
        System.out.println("the loan officer net pay is:$ " + netpay);
    }

}

this is the output
what is the loan officer id number
W1200S
please enter loan officer first name
wendell
please enter loan officer last name
saunders
what is loan officer fixed salary
5400
please enter total interest in all loans issued month
8
loan officer NIS contribution
185
loan officer payslip
the loan officer id is  W1200S
the loan officer first name is wendell  saunders
the loan officer total deduction is: $0.0
the loan officer gross pay is:$ -2.4
the loan officer net pay is:$ -2.4
BUILD SUCCESSFUL (total time: 31 seconds)

Recommended Answers

All 2 Replies

what do you mean: wrong?

If it compiles and runs, there's nothing wrong with the code, just with the logic.

can you be more specific as to what the exact result is you expect, compared to what you get?

This has all the same kinds of mistakes that we discussed in one of your earlier posts - eg almost-duplicated variables, results calculated but never used, results never calculated, no printout of the intermediate calulations. Please don't expect me to explain it all twice.

This one looks even worse because it seems to have a load of salary-related variables that have nothing to do with the input or output - the reult of copy/paste from am earlier assignment?

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.