diff --git a/starter/lab3_task1.php b/starter/lab3_task1.php
index f396a7e..ef2c212 100644
--- a/starter/lab3_task1.php
+++ b/starter/lab3_task1.php
@@ -1,13 +1,14 @@
= 36.1 && $temperature < 37.5) {
+ echo "Normal temperature
";
+}
+if ($temperature > 37.5) {
+ echo "Fever
";
+}
+if ($temperature < 36.1) {
+ echo "Hypothermia Warning
";
+}
// ══════════════════════════════════════════════════════════════
// EXERCISE B — Even or Odd
// ══════════════════════════════════════════════════════════════
@@ -31,6 +42,21 @@
// Also check divisibility by 3, by 5, and by both 3 and 5 — one line each
// TODO: Exercise B — your code here
+$number = 47;
+if (($number % 2) == 0) {
+ echo $number . " is EVEN";
+} else {
+ echo $number . "is ODD";
+}
+if (($number % 3) == 0) {
+ echo $number . "divisble by 3";
+}
+if (($number % 5) == 0) {
+ echo $number . "divisble by 5";
+}
+if ((($number % 5) == 0) && ($number % 3)) {
+ echo $number . "divisble by 3";
+}
// ══════════════════════════════════════════════════════════════
@@ -38,15 +64,17 @@
// ══════════════════════════════════════════════════════════════
// Run this code EXACTLY as written.
// Record all six outputs in your report and explain each result.
+echo "
";
+$x = 10;
+$y = "10";
+$z = 10.0;
-$x = 10; $y = "10"; $z = 10.0;
-
-var_dump($x == $y); // A: ?
-var_dump($x === $y); // B: ?
-var_dump($x == $z); // C: ?
-var_dump($x === $z); // D: ?
-var_dump($y === $z); // E: ?
-var_dump($x <=> $y); // F: spaceship — what type? what value?
+var_dump($x == $y) . "
"; // A: ?
+var_dump($x === $y) . "
"; // B: ?
+var_dump($x == $z) . "
"; // C: ?
+var_dump($x === $z) . "
"; // D: ?
+var_dump($y === $z) . "
"; // E: ?
+var_dump($x <=> $y) . "
"; // F: spaceship — what type? what value? -->
// Your explanation of each result goes in your PDF report (not here).
@@ -55,7 +83,7 @@
// EXERCISE D — Null & Default Values
// ══════════════════════════════════════════════════════════════
// Run this code as written, then extend it as instructed below.
-
+echo "
";
$username = null;
$display = $username ?? "Guest";
echo "Welcome, $display
";
@@ -68,3 +96,8 @@
echo "Config: $result
";
// TODO: Add one more chained ?? example of your own and explain it in your report.
+$class_attendance = null;
+$class_default = "Average";
+$class_performance = "Poor";
+$resultclass = $class_performance ?? $class_attendance ?? $class_default;
+echo "Perfomance: $resultclass
";
diff --git a/starter/lab3_task2.php b/starter/lab3_task2.php
index b03e13c..b0aac82 100644
--- a/starter/lab3_task2.php
+++ b/starter/lab3_task2.php
@@ -1,4 +1,5 @@
= 70
@@ -42,22 +43,92 @@
// ── 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;
+$qualified = false;
+if ($cat1 > 0) $cats_attended += 1;
+if ($cat2 > 0) $cats_attended += 1;
+if ($cat3 > 0) $cats_attended += 1;
+if ($cat4 > 0) $cats_attended += 1;
+if ($cats_attended >= 3) $qualified = true;
// ── STEP 3: Eligibility check (nested if) ─────────────────────────────────
// TODO: nested if — eligibility → grade classification → supplementary ternary
+if ($qualified && ($exam >= 20)) {
+ $eligibility = "ELIGIBLE";
+} else {
+ $eligibility = "DISQUALIFIED - Exam conditions not met";
+};
+
+if ($eligibility == "ELIGIBLE") {
+
+ if ($total >= 70) {
+ $grade = "A";
+ $remark = "Distinction";
+ } elseif ($total >= 65) {
+ $grade = "B+";
+ $remark = "Credit Upper";
+ } elseif ($total >= 60) {
+ $grade = "B";
+ $remark = "Credit Lower";
+ } elseif ($total >= 55) {
+ $grade = "C+";
+ $remark = "Pass Upper";
+ } elseif ($total >= 50) {
+ $grade = "C";
+ $remark = "Pass Lower";
+ } elseif ($total >= 40) {
+ $grade = "D";
+ $remark = "Marginal Pass";
+ } else {
+ $grade = "E";
+ $remark = "Fail";
+ }
+
+ $supplementary = ($grade == "D")
+ ? "Eligible for Supplementary Exam"
+ : "Not eligible for supplementary";
+}
+// A (Distinction): Total >= 70
+// B+ (Credit Upper): Total >= 65
+// B (Credit Lower): Total >= 60
+// C+ (Pass Upper): Total >= 55
+// C (Pass Lower): Total >= 50
+// D (Marginal Pass): Total >= 40
+// E (Fail): Total < 40
// ── STEP 4: Display formatted HTML report card ────────────────────────────
// TODO: output a clear, formatted report card showing:
// student name, each CAT score, exam score, total,
// cats attended, eligibility status, grade, remark, supplementary status
+echo "
";
+echo "Student Report Card
";
+
+echo "Name: $name
";
+
+echo "CAT Scores:
";
+echo "CAT1: $cat1
";
+echo "CAT2: $cat2
";
+echo "CAT3: $cat3
";
+echo "CAT4: $cat4
";
+
+echo "Exam: $exam
";
+echo "Total: $total
";
+echo "CATs Attended: $cats_attended
";
+echo "Eligibility: $eligibility
";
+if ($eligibility == "ELIGIBLE") {
+ echo "Grade: $grade
";
+ echo "Remark: $remark
";
+ echo "Supplementary: $supplementary
";
+}
// ── Required Test Data Sets — screenshot each ─────────────────────────────
// Set A: cat1=8, cat2=7, cat3=9, cat4=6, exam=52 → expect grade B
// Set B: cat1=9, cat2=8, cat3=0, cat4=9, exam=55 → expect grade A (check cats_attended)
diff --git a/starter/lab3_task3.php b/starter/lab3_task3.php
index d9e00c8..a3bb52c 100644
--- a/starter/lab3_task3.php
+++ b/starter/lab3_task3.php
@@ -1,13 +1,14 @@
"OK — request succeeded",
+ 301 => "Moved Permanently — resource relocated",
+ 400 => "Bad Request — client error",
+ 401 => "Unauthorized — authentication required",
+ 403 => "Forbidden — access denied",
+ 404 => "Not Found — resource missing",
+ 500 => "Internal Server Error — server fault",
+ default => "Unknown status code",
+};
+echo $result;
// ══════════════════════════════════════════════════════════════
// EXERCISE D — Rewrite comparison
diff --git a/starter/lab3_task4.php b/starter/lab3_task4.php
index 2a3d225..2eb7b21 100644
--- a/starter/lab3_task4.php
+++ b/starter/lab3_task4.php
@@ -1,4 +1,5 @@
";
+echo "--------------------------------
";
+echo "Enrolled : " . ($enrolled ? "Yes" : "No") . "
";
+echo "GPA : $gpa
";
+echo "Annual Income : KES $annual_income
";
+echo "Previous Loan : " . ($previous_loan ? "Yes" : "No") . "
";
+echo "Decision : $decision
";
// ── Required Test Data Sets — screenshot each ─────────────────────────────
// Set A: enrolled=true, gpa=3.1, income=180000, previous=false → Partial 75%