Created
June 22, 2021 20:59
-
-
Save Detective-Khalifah/bd49316abaa0c8bf124f32b339362e23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
double classAveragePoint, studentPercentage, studentPoint; | |
print('Enter percentage attained by student:'); // individual student's percentage | |
print('Enter points scored by student:'); // individual student's scored point(s) | |
print('Enter students\' average score:'); // (collective) average score of whole class | |
/*'double.parse(stdin.readLineSync())' from package 'dart:io' | |
* would be used if online consoles supported user input | |
*/ | |
classAveragePoint = 70; | |
studentPercentage = 60; | |
studentPoint = 99.9; | |
// first condition -- If the percentage is higher than or equal to 60, the student has passed the semester. | |
if (studentPercentage >= 60) { | |
if (studentPoint >= (classAveragePoint - 5)) { | |
print('====================\n' + | |
'The student, having scored $studentPoint and attained a percentage of $studentPercentage ' + | |
'has passed the semester.\n' + | |
'===================='); | |
} else { // scored points less than class average by more than 5 points | |
print('====================\n' + | |
'The student attained a percentage of $studentPercentage; but for scoring $studentPoint ' + | |
'(which is less than the class average by more than 5 points: ${classAveragePoint - studentPoint}) ,' + | |
'the student has failed the semester.\n' + | |
'===================='); | |
} | |
} else { // when percentage is less than 60 | |
print('====================\n' + | |
'The student, having scored $studentPoint and attained a percentage of $studentPercentage ' + | |
'has failed the semester.\n' + | |
'Student must attain a minimum percentage of 60 to pass the semester.\n' + | |
'===================='); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment