COMP2243 - Programming and Problem Solving

Syllabus Software Installation Assignments Tests
Lectures and Labs
**Back to Full Menu**

Selections/Decisions MinValue.java PrintingService.java QuadraticEquation.java PayrollWithDecision.java MultiSelection.java CalculatorWithSwitch.java GradeBookWithSwitch.java StringComparison.java



MultiSelection Program


Description

This program prompts the user to input a test score and then uses a multi-selection structure to determine the student grade based on the score.

Associated Concepts:

Nested selection structure

Multi-selection structure

Algorithm:

Input a test score from the keyboard.

If the score is less than 0 or greater than 100

    Output an error message

Otherwise

    If the score is greater than or equal to 90

        The grade is set to A

    Else if the score is greater than 80

        The grade is set to B

    Else if the score is greater than 70

        The grade is set to C

    Else if the score is greater than 60

        The grade is set to D

    Else

        The grade is set to F

Source Code



Sample Run



Video