Question: Technically speaking, the Pig Latin rules that we have established apply only to words, not phrases. However, your current piglatin.html page does nothing to prevent
Technically speaking, the Pig Latin rules that we have established apply only to words, not phrases. However, your current piglatin.html page does nothing to prevent users from entering a string containing spaces. Thus, a user could enter 'foo bar' in the text box and be told that the Pig Latin translation is 'oo barfay'.
Modify your PigLatin function so that, before the string is translated, the function checks whether the input is a single word (i.e., whether it contains any spaces). If there are spaces in the input, the function should return the string "ILLEGAL INPUT".
[The Classify function you wrote in Exercise 15.5 should prove useful here.]
Step by Step Solution
3.52 Rating (176 Votes )
There are 3 Steps involved in it
function PigLatin word Assumes word ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
1409-C-S-O-S(1138).docx
120 KBs Word File
