= 40 && $studentMark < 50){
$display = "supplementary exam";
}else if($studentMark >= 50 && $studentMark < 75){
$display = "Pass!";
}else{
$display = "Distinction!";
}
//return the value the stored answer, so that the returned variable produce the output when the function is called.
return $display;
}
?>
//////////////////////////////Task 5(a) //////////////////////////
Section A - Do you pass or fail
Your Total Mark is 25 and you
Your Total Mark is 40 and you are entitled to a
Your Total Mark is 45 and you are entitled to a
Your Total Mark is 50 and you
Your Total Mark is 74 and you
Your Total Mark is 95 and you received a
//////////////////////////////Task 5(b) //////////////////////////
Section B - Using a For Loop
" ;
//variable gets checked with modulus to see if it has a remainder.
}else if (($randomValue % 2) == 0){
//if there is no remainder the number is even.
echo "$randomValue is even." ;
}
}
?>
//////////////////////////////Task 5(c) //////////////////////////
Section C - Using a Do-While Loop
" ;
//variable gets checked with modulus to see if it has a remainder.
}else if (($randomValue % 2) == 0){
//if ther is a remainder, the number is even.
echo "$randomValue is even." ;
}//after each loop the counter will iterate.
$doWhileCounter++;
//then only will it test with a conditional expression to check if the loop should loop again.
}while ($doWhileCounter <= 10);
?>
//////////////////////////////Task 5(d) //////////////////////////
Section D - Using a While Statement and Switch statement
';
break;
case 2:
echo 'South';
break;
case 3:
echo 'East';
break;
case 4:
echo 'West';
break;
}
//whenever it echo's the result, the counter iterates and the loop goes all over testing condition in the while loop.
$count++;
}
?>