Case Statment Crisis!!!

Started by Nexa, November 13, 2004, 09:01:24 PM

Previous topic - Next topic

oops I forgot to post my message  ;D, but my crisis is how to build this case statment!  I need some help, I have a truly hard time understanding programing.

How would I go about constructing a case statement that has:
fixed salary workers
hourly salary workers at 40hrs a weeks with time and a half (1.5) for overtime
commision workers who receive $100 plus 4.3% of their gross weekly sales
and pieceworkers who receive only when the produce an item and that particular item is a pays a specific amout.

Actually a Switch statment not a case statement.

thanks
Nexa :-[

Hey,

Don't have much time here, and I am not checking the boards as much as I had even a couple weeks ago. I dont know if this will help, but here you go.. basic idea is this :

The syntax of a switch statement is :

Code  cpp Select
switch (var) 
   {
    case <x>: 
         <code>
         <break or return>
    case <y>:
          <code>
          <break or return>
    default:
          <code>
          <break or return>
   }


Where code can be any valid statement, including just returning or breaking right then. var is the variable you're checking against. Just remember to ALWAYS break or return at the end of EACH case, or it'll follow through to the next one! And you'll want to ALWAYS include a default statement (just in case the value isn't found earlier)

The <x>/etc MUST be constant.

So '1' is valid, and so is 1..

I hope that helps.
"My Terminal is my Soul"

SMF spam blocked by CleanTalk