hi all

how can I make this program to work? it is loopinging and this is wher it stop,it is no reading anything else

where have i gone wrong here is the code and the output

 char F, f, H, h, C, c;
            double hrswrked, grosspay = 0, netpay, payrate, totaldeduct = 0, deduction, overtime, extra_time;
            double comm_incent = 0, fixedsal = 0, taxfree_allow, totalgross_pay, totalnetpay, totalsales = 0;
            String empfirst_name, emplast_name, hourlypaid_workers, payroll_report, payroll_payslip, process_workers, monthlyfixed_workers;
            String commiss_workers;
            int taxes = 0, emp_idnum, highest, lowest,highestpaid_workers, lowestpaid_workers, highestvalue_workers, lowestvalue_workers;
            char inputChar = 0, Char;
           double totalpay = 0;


            for(int i=1; i<=3; i++){

                System.out.println("please enter the employee id number");
                emp_idnum = input.nextInt();

                System.out.println("please enter the employee first name");
                empfirst_name = input.next();

                System.out.println("please enter the employee last name");
                emplast_name = input.next();


             if(Character.toUpperCase(inputChar) ==('F') || Character.toLowerCase(inputChar) ==('f')){


               System.out.println("enter your usercode");
               System.out.println("please enter the employee fixed salary");
               fixedsal = input.nextDouble();
            } 


               else if(Character.toUpperCase(inputChar) == ('C') || Character.toLowerCase(inputChar) == ('c'))
            {  

               System.out.println("enter your usercode");
               System.out.println("please enter the employee fixed salary " + fixedsal);
               fixedsal = input.nextDouble();
               System.out.println("please enter the total sales of the month " + totalsales);
               totalsales = input.nextDouble();

            }

               else if(Character.toUpperCase(inputChar)== ('H') || Character.toLowerCase(inputChar)== ('h'))
            {

                 System.out.println("enter your usercode");
                 System.out.println("please enter the pay rate");
                 payrate = input.nextDouble();
                 System.out.println("please enter the hours of work for the month");
                 hrswrked = input.nextDouble();

                 totaldeduct = calGrossF(grosspay, totaldeduct);
                 totalpay = calGrossH(hrswrked, payrate);
                 totalsales = calGrossC(fixedsal, comm_incent);
                 grosspay = calDeductions(grosspay, taxes);
                 netpay = calNetpay(grosspay, totaldeduct);
            }
        }

     }
}
the output
please enter the employee id number
1200
please enter the employee first name
lenny
please enter the employee last name
john
please enter the employee id number
1458
please enter the employee first name
shaun
please enter the employee last name
jessel
please enter the employee id number
1200
please enter the employee first name
paula
please enter the employee last name
small

need help plz thnkz

Recommended Answers

All 6 Replies

we don't know what your code is supposed to be doing, nor what it is doing wrong in your eyes. All we can comment on is what the code will be doing.

If you want us to be able to be more helpfull, be more clear about what output you expect, and what result you are actually getting.

Look at your line 11. What do you think that does?

yes james it is a for loop what i meant is why is it not reading the rest of thes codes

i know it is supposed to loop three times snd my expectation is that i want it to be able to read the rest of the codes.
it loop three times as in the for loop and it stop right there

All the code for prompting and printing is inside that loop, so it will do all that exactly 3 times, then it leaves the loop (line 58), which is the end of the code, so it stops.
Your program is doing exactly what you told it to do.
I don't know why you have the 1..3 loop.

the loop is for 3 workers. one for commission, one for hourly paid and the last for fixed monthly paid. okay so the program is doing what it is supposed to do per say, but my question is why is it not reading the rest of the codes.

divinity: this would be easier to answer if you told us what "rest of codes" you expected to be read and aren't read, and what input you provide to the application.

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.