Validate a Range
mediumQuestion 777Read a score. Valid scores are 0 to 100 inclusive. If the score is outside that range, throw new ArgumentOutOfRangeException(nameof(score), "score must be 0-100"). Otherwise print Score: <score>. Catch the exception and print exactly Score out of range. Use top-level statements with try/catch.
Input 80 prints: Score: 80
Input 150 prints: Score out of range
Expected output
Score: 80= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Exceptions
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.