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

Learning Plan 5 Process Inventory Items

# Example 4: Process Inventory Items

#### File: /Learning Plan 5/example-example4.html

### Problem Statement

> Write a program to read a series of inventory records that contain an item number, and item description and a stock amount. The is to produce a low stock items report, by print only those records that have a stock amount of less than 20 items. A heading is to be printed at the top of the report and a total low stock item count printed at the end.

### Program Planning Lists

- In the following pre tag, write the three planning lists based on the verbs and nouns you see in the problem statement.

    The List of Input Variables:
        record:
            itemNumber
            itemDescription
            stockAmount
            heading

    The List of Output Variables:
        heading
        itemNumber
        itemDescription
        stockAmount
        totalLowStockItems

    The Process Checklist:
        read inventory records
        select low stock items
        print low stock items
        print total low stock items

### Part 2 Test Plan

    VARIABLES:

    TEST CASE 1:

        INPUT VALUES: Record Set

        EXPECTED RESULT: 201 Gadgets 17

    TEST CASE 2:

        INPUT VALUES: Record Set

        EXPECTED RESULT: 203 Toggles 12

    TEST CASE 3:

        INPUT VALUES: Record Set

        EXPECTED RESULT: Total Low Stock Items: 6

### 5. JavaScript Output

> Write the JavaScript code based on everything you've done.

- Here's the code:

- Here's the output: