![]() |
|
|
#1 |
|
Junior Member
Join Date: Sep 2010
Location: NC
Posts: 9
![]() |
Ok I thought structures were hard but decisions are horrible. Really confused on the if then else, and or, and when and how to understand when they are used. For example:
if department < 3 then raise = SMALL_RAISE else if department < 5 raise = MEDIUM_RAISE else raise = BIG_RAISE end if end if So would this be a SMALL_RAISE, MEDIUM_RAISE. or BIG_RAISE and why? __________________
Members don't see ads in threads. Register your free account today and become a member on Tech Today Online, gaining access to posting privileges, contests, free plug-ins and other downloads, unlimited online storage for your photographs, reviews, free marketplace listings, and much more. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2010
Location: Doylestown, PA
Posts: 159
![]() |
Roxy, what this is saying is:
assuming the department number are positive integers, If you work in departments, 0, 1 or 2, you will get a SMALL_RAISE If you work in department 4 you will get a MEDIUM_RAISE If your department is 5 or anything higher, you will get a BIG_RAISE Why: a SMALL_RAISE is given if your department is LESS THAN 3 (0, 1 or 2) a MEDIUM_RAISE is LESS THAN 5, but since 0, 1 and 2 were taken care of by the first IF, that only leaves 4 If your department is anything else (5 or greater) it is assigned BIG_RAISE by the last ELSE which catches all other conditions. Make sense?
__________________
-John |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2010
Location: NC
Posts: 9
![]() |
Yes that does make sense. Why couldn't you be my teacher???? I appreciate your help and hope you don't think I am to dumb.
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jul 2010
Location: Doylestown, PA
Posts: 159
![]() |
Glad to be of help Roxy.
The problem with learning structured programming is that we learn to process lots of information simultaneously to make decisions (sight, sound, touch, smell, etc.). In programming, the computer only executes one single instruction at a time, so breaking everything down to it's most basic component can be a challenge. It just takes practice so stick with it and you'll be fine. The only dumb question is the one you never ask.
__________________
-John |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Understanding Structure in Programming | Roxy | Ask the Experts | 8 | 09-22-2010 03:11 PM |