-
Notifications
You must be signed in to change notification settings - Fork 0
/
Question1.php
36 lines (26 loc) · 1.21 KB
/
Question1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!-- Write a program that determines a student’s grade. The program will have three variables for the three types of
scores (quiz, mid-term, and final scores) and determine the grade based on the following rules:
• if the average score >=90% =>grade=A
• if the average score >= 70% and <90% => grade=B
• if the average score>=50% and <70% =>grade=C
• if the average score<50% =>grade=F -->
<?php
// ======== three variable (grades) ======== \\
$quiz = 71;
$midTerm = 93;
$finals = 57;
echo "<br> ========================= LAB 1 QUESTION #1 ============================= " . "<br><br>";
// ======== The average of the students three grades ======== \\
$totalAverage = (($quiz + $midTerm + $finals) / 3);
echo "Final average mark is: " . round($totalAverage) . "%.<br>";
// ======== Verify which mark falls into which category (Grade) ======== \\
if ($totalAverage >= 90){
echo "The student has achieved a: GRADE A";
}elseif ($totalAverage >= 70 && $totalAverage < 90) {
echo "The student has achieved a: GRADE B";
}elseif ($totalAverage >= 50 && $totalAverage < 70){
echo "The student has achieved a: GRADE C";
}elseif ($totalAverage<50){
echo "The student has achieved a: GRADE F";
}
?>