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

1 Expert Approved Answer
Step: 1 Unlock

function PigLatin word Assumes word ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

1409-C-S-O-S(1138).docx

120 KBs Word File

Students Have Also Explored These Related Operating System Questions!