Northcentral Technical College Introduction To Programming
10-152-310
Introduction to Programming with JavaScript NTC 10-152-310

Learning Plan 4 Selection Algorithm

# Example: Selection Algorithm

#### File: /Learning Plan 4/example1.html

### Problem Statement

> Design a program that will prompt a user for three characters, accept those characters as input, sort them into ascending sequence and output them to the screen.

### The Program Planning Lists

- Convert the nouns and verbs into variable names and processes and create a defining diagram.

    The List of Input Variables:
        characterOne
        characterTwo
        characterThree

    The List of Output Variables:
        characterOne
        characterTwo
        characterThree

    The Process Checklist:
        prompt for characters
        sort three characters
        output three characters

### The Test Plan

    TEST CASE 1:

        INPUT VALUES:  c, a, b

        EXPECTED RESULT: a, b, c

        ACTUAL RESULT: a, b, c

    TEST CASE 2:

        INPUT VALUES: a, A, a

        EXPECTED RESULT: A, a, a

        ACTUAL RESULT: A, a, a

    TEST CASE 3:

        INPUT VALUES: f, 5, $

        EXPECTED RESULT: 5, $, f <-- Wrong!

        ACTUAL RESULT: $, 5, f

### JavaScript Output

- Here's the code:

- Here's the output: