Topical Information

This project will help you show your mastery of branching, looping, strings, and even arrays (in parallel?).

Program Information

Write a program to read in a line of text and output the number of words in the line as well as the number of occurrences of each letter [present]. A word is defined to be any sequence of letters that is delimited at each end by whitespace, terminal punctuation (which would be periods, commas, colons, etc. but not single quotes, hyphens, or such), or an end of the line (be it the beginning or actual end). You should make no assumptions about the content of the user's line — allow any legitimate input characters.

When outputting the number of letters that occur in a line, be sure to count upper- and lower- case versions of a letter as the same letter. Output the letters in alphabetical order. As implied above, only list letters that occur in the input line.

For example, if the user entered 'I say Hi.', your program should produce something like:

    Your line contained 3 words.

    The following letters occurred the indicated number of times:

        a 1
        h 1
        i 2
        s 1
        y 1

But if the user entered 'How do you do? Our Home and Office production line of products does just about anything you'd expect an ordinary one to do -- but there's more!', you'd report:

    Your line contained 26 words.

    The following letters occurred the indicated number of times:

        a  5
        b  2
        c  4
        d  9
        e 10
        f  3
        g  1
        h  4
        i  5
        j  1
        l  1
        m  2
        n  8
        o 19
        p  3
        r  7
        s  4
        t  9
        u  8
        w  1
        x  1
        y  4

You must input the entire line at once (as implied above). You cannot read their input word-by-word!

This assignment is (Level 6).

Options


Note: This project is adapted from ones given in textbooks by Walter Savitch.


Total Level Possible

If you did all above options, this project could be worth as much as (Level 16).