Skip to content

Instantly share code, notes, and snippets.

@abdorll
Created April 27, 2022 08:15
Show Gist options
  • Save abdorll/54e3f561aef91f222d79c566f28f0a5e to your computer and use it in GitHub Desktop.
Save abdorll/54e3f561aef91f222d79c566f28f0a5e to your computer and use it in GitHub Desktop.
🎯💻Title: Side Hustle capstone project, Department: Mobile App Development, Group nō: 73, Group Leader: Opadeji Abdullah Ololade (SH-IT-0005487)🎯💻
//Root of our application
void main () {
//Parsing subject and score vals as arguments of scoreAndSubjectResult method
scoreAndSubjectResult(60, "Physics");
scoreAndSubjectResult(80, "Chemistry");
}
//Give output of subject's score based on the val of the score
scoreAndSubjectResult(score, subject){
//Instance of SubjectAndScore class
SubjectAndScore subjectAndScore = SubjectAndScore();
subjectAndScore.subject = subject;
subjectAndScore.score = score;
scoreCheck(score, subject);
}
//Condition to determine subject's score grade
scoreCheck(score, subject){
if ((score >= 80) & (score <= 100)) {
print ("Your grade for $subject is A");
} else if ((score >= 60) & (score <= 79)) {
print ("Your grade for $subject is B");
} else if ((score >= 50) & (score <= 59)) {
print ("Your grade for $subject is C");
} else if ((score >= 40) & (score <= 49)) {
print ("Your grade for $subject is D");
} else if (score < 40) {
print ("Your grade for $subject is F");
} else {
print (" Your grade for $subject is not found");
}
}
//Creating our subject and score class
class SubjectAndScore{
String? subject;
num? score;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment