Lab 1340 - Spelling Rules


Cletus, my best friend in high school, was a terrible speller. Once, when Candid Camera visited Benedictine Military School, Clete was asked to spell the word "chauffeur" and he spelled it "shopher." What he needed was a program that would check for his two most common spelling errors. The first rule is that the letter u always follows the letter q. The second rule is " i before e except after c."


You are given a data file test.txt that contains violations of those two grammatical rules. Your assignment: write a class SpellRules to find and report violations of the two grammatical rules stated above.

You can test your SpellRules class with this code:

public class TestSpellRules
  public static void main (String[] args)
      SpellRules ms = new SpellRules("test.txt");

Using the text file test.txt, your checkRules method should complain about the words "qwotation", "recieved", "beleived", and "concierge". The latter word is spelled correctly, and indeed there are many exceptions to the "i before e..." rule. Your code should miss the fact that "their" is misspelled as "thier" in test.txt, being one of the exceptions. Cletus just wants a list he can check over, or more accurately, to ask me to check over. That's what freinds are for. So just follow the two rules as stated when writing your code.

Copyright © 2010 by Asylum Computer Services LLC Return to CS Labs