CPE 103 Lab Activity

Sets



Overview

Do you know the reason for the arrangement of letters on a standard keyboard? QWERTY keyboard layout



The Dvorak keyboard is argued to be a vastly more comfortable and efficient alternative to the standard "QWERTY" pattern, because the most commonly occurring  letters in English appear on the home row.


Dvorak keyboard layout


Assignment

Write a program using Sets to read a file of English text and count the number of characters that appear on each of the three rows of both style keyboards.  Consider only alphabetic characters, not numbers or punctuation.  The name of the file will be provided on the command line.  Follow the examples in the command line tutorial.

Instructions
  1. Compute by hand the results for QWERTY and Dvorak using this sample sentence: "amazingly few discotheques provide jukeboxes".
  2. Write a Java program to meet the requirements above. You should use Sets and Lookup tables effectively in your solution.
  3. Avoid brute force solutions. (A chain of six if statements is not acceptable).
  4. The output should appear something like this:

    QWERTY

    Dvorak


    count
    %
    count %
    Top row
    200
    40
    100
    20
    Home row
    200
    40
    300
    60
    Bottom row
    100
    20
    100
    20
    Total
    500

    500


  5. (Consider printf for column alignment.)

  6. Test your program using the sample sentence and verify that the results match your manually calculated answers.
  7. Once your program passes your tests, run it on the complete text of "The Adventures of Huckleberry Finn" by Mark Twain.  If you finish during the lab hour show your results to the instructor so they can be checked for correctness. Record the results in a comment in the header of your source code.
  8. JUnit tests are recommended but not required on this lab.
  9. You must submit execution output with the sample sentence and with Huckleberry Finn.