Class Exercise: Control Structures II
1. If statement:
Compare the variables $groupIn and $groupControl. When $groupIn is
greater than $groupControl, print a group control footing and assign
$groupIn to $groupControl.
2. If-else statement:
Enhance your response to question 1 to include an alternative selection
when the condition is false. This alternative should include a statement
print a detail line, add $cost to $totalCost, and assign blanks or an
empty string to $id.
3. While loop:
Construct a while loop with a statement block to input and print data from
a file with the pointer $fp and input area named $lineIn. The loop should
continue as long as file data can be found. Within the loop body, print
$lineIn, then input the next line of data.
4. For loop:
Code a for statement to iterate through a set of statements that attempts
to locate an $idArray value equal to the variable $searchKey. This search
should continue until a match is found or the entire array has been searched.
At its conclusion, the variable $indexFound should contain the array index
value or it's original value of -1.
5. Foreach loop:
Prepare a foreach structure to iterate through $nameArray printing each value.