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



GradeBookWithSwitch Program


Description

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

Associated Concepts:

Switch structure

Algorithm:

Input a test score from the keyboard.

Use '/' operator to retrieve the quotient of the test score

Then use switch to evaluate the quotient of the test score

    For 9 or 10

        The grade is set to A

    For 8

        The grade is set to B

    For 7

        The grade is set to C

    For 6

        The grade is set to D

    For any other number

        The grade is set to F

Source Code



Sample Run



Video