String Project



Posted : 6 months ago

“Vowels-R-Us

The project described below is from the American Computer Science League which was used in one of their early competitions.  The project demands careful reading and understanding of the task at hand.  It also brings together a great many skills we have developed since the beginning of the course.   Among these are :  reading from an external data file, using loops, using conditional branching, designing our own methods and using the String class.  Be advised that you will need to develop a careful design before you begin this project.  You also may need to review earlier material on reading from an external data file.  A data file will be provided for test purposes. 

 

Problem  Definition :  The vowels on planet ACSL are naturally enough, the letters  A, C, S, and L.  All other letters are considered to be consonants.  There are two tasks associated with each word :  forming the plural and adding a suffix.  Your program is to form the plural of words and attach suffixes according to the following rules :

 

 

If the word …

to form the plural…

to add a suffix that starts with consonant…

to add a suffix that starts with a vowel...

Ends in a single consonant

Add  “GH”

Add the suffix

Add the suffix

Ends in a single vowel

Drop the final vowel and add ‘G’

Add the first letter of the suffix and then add the suffix

Drop the first letter of the suffix and add the rest of the suffix

Ends in 2 or more consonants or 2 or more vowels

Double the last letter, then add ‘H’

Drop the leftmost letter of the final sequence of either vowels or consonants, then add the suffix

Add the first letter of the suffix, then add the suffix

 

 

Sample Data :                                                            Sample Output :

            XQAC ZVM                                                  Original String :  XQAC ZVM

            PDAE AV                                                                  Plural :  XQACCH

            SNIC SY                                                                    Suffix :  XQCZVM

                                                                                    Original String :  PDAE AV

                                                                                                Plural :  PDAEGH

                                                                                                Suffix :  PDAEAV

                                                                                    Original String :  SNIC SY

                                                                                                Plural :  SNIG

                                                                                                Suffix :  SNICY




Files Attached


No answers yet