diff --git a/starter/lab3_task1.php b/starter/lab3_task1.php
index f396a7e..2932176 100644
--- a/starter/lab3_task1.php
+++ b/starter/lab3_task1.php
@@ -3,11 +3,11 @@
* ICS 2371 — Lab 3: Control Structures I
* Task 1: Simple if and if-else — Warm-Up Exercises [5 marks]
*
- * @author [Your Full Name]
- * @student [Your Reg Number, e.g. SCT212-XXXX/2024]
+ * @author [SUNDRA EVANS]
+ * @student [ENE212-0148/2023]
* @lab Lab 3 of 14
* @unit ICS 2371
- * @date [Date completed]
+ * @date [03/04/2026]
*/
// ══════════════════════════════════════════════════════════════
@@ -20,8 +20,19 @@
// "Hypothermia Warning" if temp < 36.1
// Test with: 36.8, 39.2, 34.5 — screenshot each
-// TODO: Exercise A — your code here
+$temperature = 36.8;
+echo "Temperature: $temperature °C
";
+if ($temperature >= 36.1 && $temperature <= 37.5) {
+ echo "Normal
";
+}
+if ($temperature > 37.5) {
+ echo "Fever
";
+}
+if ($temperature < 36.1) {
+ echo "Hypothermia Warning
";
+}
+echo "
";
// ══════════════════════════════════════════════════════════════
// EXERCISE B — Even or Odd
@@ -30,8 +41,37 @@
// Use if-else to print "$number is EVEN" or "$number is ODD"
// Also check divisibility by 3, by 5, and by both 3 and 5 — one line each
-// TODO: Exercise B — your code here
+$number = 47;
+// Even or Odd
+if ($number % 2 == 0) {
+ echo "$number is EVEN
";
+} else {
+ echo "$number is ODD
";
+}
+
+// Divisible by 3
+if ($number % 3 == 0) {
+ echo "$number is divisible by 3
";
+} else {
+ echo "$number is NOT divisible by 3
";
+}
+
+// Divisible by 5
+if ($number % 5 == 0) {
+ echo "$number is divisible by 5
";
+} else {
+ echo "$number is NOT divisible by 5
";
+}
+
+// Divisible by both 3 and 5
+if ($number % 3 == 0 && $number % 5 == 0) {
+ echo "$number is divisible by BOTH 3 and 5
";
+} else {
+ echo "$number is NOT divisible by BOTH 3 and 5
";
+}
+
+echo "
";
// ══════════════════════════════════════════════════════════════
// EXERCISE C — Comparison Chain
@@ -48,6 +88,9 @@
var_dump($y === $z); // E: ?
var_dump($x <=> $y); // F: spaceship — what type? what value?
+echo "
";
+echo "
";
+
// Your explanation of each result goes in your PDF report (not here).
@@ -60,6 +103,8 @@
$display = $username ?? "Guest";
echo "Welcome, $display
";
+echo "
";
+
// Chained null coalescing
$config_val = null;
$env_val = null;
@@ -67,4 +112,11 @@
$result = $config_val ?? $env_val ?? $default;
echo "Config: $result
";
+echo "
";
+
// TODO: Add one more chained ?? example of your own and explain it in your report.
+$input_name = null;
+$cookie_name = null;
+$session_name = "Mwenda";
+$final_name = $input_name ?? $cookie_name ?? $session_name ?? "Anonymous";
+echo "User: $final_name
";
diff --git a/starter/lab3_task2.php b/starter/lab3_task2.php
index b03e13c..c72c912 100644
--- a/starter/lab3_task2.php
+++ b/starter/lab3_task2.php
@@ -7,20 +7,20 @@
* report BEFORE writing any code below. Marks are awarded for all
* three components: pseudocode, flowchart, and working code.
*
- * @author [Your Full Name]
- * @student [Your Reg Number, e.g. SCT212-XXXX/2024]
+ * @author [SUNDRA EVANS]
+ * @student [ENE212-0148/2023]
* @lab Lab 3 of 14
* @unit ICS 2371
- * @date [Date completed]
+ * @date [03/04/2026]
*/
// ── Test Data Set A (change values to run other test sets) ─────────────────
-$name = "Your Name";
-$cat1 = 8; // out of 10
-$cat2 = 7; // out of 10
-$cat3 = 9; // out of 10
-$cat4 = 6; // out of 10
-$exam = 52; // out of 60
+$name = "Sundra Evans";
+$cat1 = 0; // out of 10
+$cat2 = 0; // out of 10
+$cat3 = 0; // out of 10
+$cat4 = 0; // out of 10
+$exam = 15; // out of 60
// ── Grade Rules (implement using if-elseif-else, ordered highest first) ────
// A (Distinction): Total >= 70
@@ -41,15 +41,60 @@
// Otherwise: "Not eligible for supplementary"
// ── STEP 1: Compute total ─────────────────────────────────────────────────
-// TODO: compute $total
+$total = $cat1 + $cat2 + $cat3 + $cat4 + $exam;
// ── STEP 2: Count CATs attended ───────────────────────────────────────────
-// TODO: compute $cats_attended (each CAT > 0 counts as attended)
+$cats_attended = 0;
+if ($cat1 > 0) $cats_attended++;
+if ($cat2 > 0) $cats_attended++;
+if ($cat3 > 0) $cats_attended++;
+if ($cat4 > 0) $cats_attended++;
// ── STEP 3: Eligibility check (nested if) ─────────────────────────────────
-// TODO: nested if — eligibility → grade classification → supplementary ternary
+$eligible = 'Disqualified';
+$grade = 'N/A';
+$description = 'DISQUALIFIED';
+$remark = 'Exam conditions not met';
+$supplementary = 'Not eligible for supplementary';
+
+if ($cats_attended >= 3 && $exam >= 20) {
+ $eligible = 'Eligible';
+ // Grade using if-elseif-else, highest first
+ if ($total >= 70) {
+ $grade = 'A'; $description = 'Distinction';
+ } elseif ($total >= 65) {
+ $grade = 'B+'; $description = 'Credit Upper';
+ } elseif ($total >= 60) {
+ $grade = 'B'; $description = 'Credit Lower';
+ } elseif ($total >= 55) {
+ $grade = 'C+'; $description = 'Pass Upper';
+ } elseif ($total >= 50) {
+ $grade = 'C'; $description = 'Pass Lower';
+ } elseif ($total >= 40) {
+ $grade = 'D'; $description = 'Marginal Pass';
+ } else {
+ $grade = 'E'; $description = 'Fail';
+ }
+
+ $supplementary = ($grade === 'D')
+ ? 'Eligible for Supplementary Exam'
+ : 'Not eligible for supplementary';
+
+ $status = "Grade {$grade} — {$description}";
+ $remark = $description;
+
+
+ } else {
+
+ $eligible = 'Disqualified';
+ $grade = 'N/A';
+ $description = 'DISQUALIFIED';
+ $remark = 'Exam conditions not met';
+ $supplementary = 'Not eligible for supplementary';
+ $status = 'DISQUALIFIED — Exam conditions not met';
+}
// ── STEP 4: Display formatted HTML report card ────────────────────────────
@@ -57,10 +102,183 @@
// student name, each CAT score, exam score, total,
// cats attended, eligibility status, grade, remark, supplementary status
+?>
+
+
+
Academic Performance Summary
+| CAT Scores | |
| CAT 1 | / 10 |
| CAT 2 | / 10 |
| CAT 3 | / 10 |
| CAT 4 | / 10 |
| Exam & Totals | |
| Final Exam | / 60 |
| Total Score | / 100 |
| CATs Attended | / 4 |
| Status | |
| Eligibility | ++ $eligible"; + ?> + | +
| Supplementary | ++ $supplementary"; + ?> + | +