June 30, 2022, 12:11:15 PM

Author Topic: Case Statment Crisis!!!  (Read 8609 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
Case Statment Crisis!!!
« on: November 13, 2004, 09:01:24 PM »


  • Guest
Re:Case Statment Crisis!!!
« Reply #1 on: November 13, 2004, 09:09:34 PM »
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.

Nexa :-[

Offline Metgod

  • the deranged hacker
  • Administrator
  • Forum Hero
  • *****
  • Posts: 1116
  • Country:
  • Gender: Male
Re:Case Statment Crisis!!!
« Reply #2 on: December 02, 2004, 10:00:11 AM »

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 :

switch (var)
    case <x>:
         <break or return>
    case <y>:
          <break or return>
          <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"