Creating a grading system PHP Result
https://stackoverflow.com/questions/41474741/creating-a-grading-system-php
https://webcheatsheet.com/php/if_else_switch.php
what is exactly what you are trying to achieve ? A code that gives you your grade ( in categories ) based on the provided 2 scores ?
You could implement switch statment in order to achieve this. The pseudo code goes like this:
$workScore = $_POST['coursework'];
switch($workScore) {
case $workScore >= 70 and $workScore <= 100:
echo 'Your Grade is A';
break;
case $workScore >= 60 and $workScore <= 69:
echo 'Your Grade is B+';
break;
case $workScore >= 59 and $workScore <= 60:
echo 'Your Grade is B';
break;
default:
echo 'something else':
}
Then after you have both results: written and work, then you calculate you final score and send it to the end user
------------------------------ ------------------
<?php
$result = 70;
if ($result >= 75) {
echo "Passed: Grade A <br />";
}
elseif ($result >= 60) {
echo "Passed: Grade B <br />";
}
elseif ($result >= 45) {
echo "Passed: Grade C <br />";
}
else {
echo "Failed <br />";
}
?>
------------------------------ ------------------
<?php
$result = 70;
if ($result >= 57) {
echo "Pass <br />";
}
else {
echo "Fail <br />";
}
?>
------------------------------ ------------------
<?php
$result = 70;
if ($result >= 75) {
echo "Passed: Grade A <br />";
}
elseif ($result >= 60) {
echo "Passed: Grade B <br />";
}
elseif ($result >= 45) {
echo "Passed: Grade C <br />";
}
else {
echo "Failed <br />";
}
?>
------------------------------ ------------------
<?php
$result = 70;
if ($result >= 57) {
echo "Pass <br />";
}
else {
echo "Fail <br />";
}
?>
Comments
Post a Comment