trying for the longest while to get this program to run at least properly, havent finished entering all of the codes as, just testing each part of the statement before i add in the rest of the codes

the program is not working properly dont know where I have gone wrong because it is only reading up to the employee last name and stop. it is not even looping

so tell me where i have gone wrong, what is wrong with it. the program run up until the employee last name and stop

 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')){
                inputChar = input.next().charAt(0);


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

             }
            else if(Character.toUpperCase(inputChar) == ('C') || Character.toLowerCase(inputChar) == ('c')){
               inputChar = input.next().charAt(0);

               System.out.println("enter your usercode");
               System.out.println("please enter the employee fixed salary " + fixedsalary);
               fixedsalary = 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'));
             inputChar = input.next().charAt(0);
         }    

     }


}    

Well, I don't see where you are declaring the inputChar variable. Please show the entire class.

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

Are you the chairman of the Department of Redundancy Department?

there is a semicolumn on line 33, the code won't compile

my dear traevel

if that is the way you does help pple by insulting them, then I wouldnot want to around when you also in your learning stages of java, thanks traevel for the help and insults.

divinity: that wasn't an actual insult. he was pointing out that your code makes very little sense.

for instance, the line he copied:

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

Can you honestly say that you are capable of thinking of a way that the first expression (Character.toUpperCase(inputChar) ==('F')) would return false, yet the second one (Character.toLowerCase(inputChar) ==('f')) would return true ?

I can assure you: this is not even theoretically possible.
at this point, each time the first expression returns false, you still go through all the mess to convert the char to lowercase, and run the exact same test on it.

Slavi: the code will compile and run, but the semicolon ends the actual if block, so the following statement will be executed no matter what the returned value of the expression in that if statement is.

thank you stultuske for taking the time to explain it better.

if one statement is false and the other is true what do i do to make both statement true

what do you mean, one is false and the other is true ? the OR operator (| or || ) do this. But:

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

is exactly the same as:

if(Character.toUpperCase(inputChar) ==('F'))

because it is not possible for the char to be both F and not be F

thanks traevel for the help and insults.

It wasn't an insult, it was meant to stimulate a little thought on your end as to what you were actually writing there.

when you also in your learning stages of java

When I was learning Java I at least took the time to read the very first chapter of my textbook. And I did not ignore people's answers to my questions. Or did you forget you already posted this same part of code last time. Read James' comment again. Declare the variable before using it. It's chapter 1, paragraph 1 of any Java book.

Or keep posting the same question everywhere and see if someone will eventually write it for you.

dear traevel
i did declare it as stated and it was still doing the same thing. and yes I did post it on another site and they werent as insulting as you. matter of fact they were patient and helpful. I am only just trying to understand why it wasnt working and yes I do read java books as you seem to imply that I dont

matter of fact they were patient and helpful.

If they were you wouldn't have had to ask again here.

i did declare it as stated and it was still doing the same thing.

I never read my telepathy book. You did not declare it in the part you posted.

But let's move on.

You declared the variable. So it's not throwing an error on that. Read what you are writing:

if(Character.toUpperCase(inputChar) ==('F'){
    inputChar = input.next().charAt(0);

    // do stuff
}

Those two lines. What is happening? In what order is it happening? What is supposed to happen? And in what order is it supposed to happen?

It's not executing because inputChar is not containing f or F. Why is it not containing f or F?

Ask the user's input first, then check that input. What you're doing is checking first, then asking.

i did declare i didnt post the whole of the codes that i write including the variables, i just post that part because i wanted to know why it wasnt running as it should hve been.

Ok guys, let's keep this friendly please.

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.