Created
May 4, 2015 09:25
-
-
Save mikestratton/1ac4f2762cf109010ce3 to your computer and use it in GitHub Desktop.
Input student score and outputs grade results with message.
This file contains hidden or 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
#output grade results dependent on student score | |
puts "Enter the students score: " | |
score = gets.to_i | |
while score > 100 | |
puts "You must enter a number less then or equal to 100 " | |
puts "Enter the students score: " | |
score = gets.to_i | |
end | |
while score == 100 | |
puts "PERFECT SCORE! FANTASTIC! A score of #{score} gives you a perfect A" | |
exit | |
end | |
while score >= 90 and score <= 99 | |
puts "CONGRATULATIONS! A score of #{score} gives you an A" | |
exit | |
end | |
while score >= 80 and score <= 89 | |
puts "Very good! A score of #{score} gives you a B" | |
exit | |
end | |
while score >= 70 and score <= 79 | |
puts "You can do better. A score of #{score} gives you a C" | |
exit | |
end | |
while score >= 60 and score <= 69 | |
puts "Warning! Be careful. A score of #{score} gives you a D" | |
exit | |
end | |
while score <= 59 | |
puts "FAILURE! You have failed your exam. A score of #{score} gives you an F" | |
exit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment