Skip to content

Instantly share code, notes, and snippets.

@elminson
Created July 11, 2020 00:56
Show Gist options
  • Save elminson/b3a3b0a5e07310d841543212018ccb50 to your computer and use it in GitHub Desktop.
Save elminson/b3a3b0a5e07310d841543212018ccb50 to your computer and use it in GitHub Desktop.
<?php
class courseGrade
{
public function grade($currentGrade)
{
if (!is_integer($currentGrade)) {
return "Invalid Data";
}
if ($currentGrade < 60) {
return "Try again";
}
if ($currentGrade > 100) {
return "Value No Valid";
}
if ($currentGrade >= 70 and $currentGrade < 80) {
return 'Well';
}
if ($currentGrade >= 80 and $currentGrade < 90) {
return "Very good";
}
if ($currentGrade >= 90 and $currentGrade <= 100) {
return "Satisfying";
}
if ($currentGrade >= 60 and $currentGrade < 70) {
return "Enough";
}
}
}
$currentGrade = 65;
$newGrade = new courseGrade();
echo $newGrade->grade($currentGrade);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment