Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that converts words to pig Latin. Words that begin with a vowel

ID: 3619600 • Letter: W

Question

Write a program that converts words to pig Latin. Words that begin with a vowel are unchanged. Words that begin with a consonant have the starting consonant moved to the end of the word and “ay” is appended after the consonant. If the input is only the single letter “q” or “Q,” the program quits. Given the inputs “open,” “door,” and “q,” make the program produce the following display:



Sample session:



PIG LATIN WORD CONVERTER



Enter a word: open

In Pig Latin, that's "open"

Enter a word: door

In Pig Latin, that's "oorday"

Enter a word: q

I hope you enjoyed your porcine experience! Please come again.



Here is the algorithm:



print “Enter a word: ”

input line

while line is not equal to “q”

set okInput to true

step through characters in input line

if any one is not a letter

set okInput to false

print “Invalid input - can’t process this character” badCharacter

if okInput is still true

set pigWord to “”

if first character is a vowel

append first character to pigWord

set suffix to “”

else

set suffix to firstCharacter “ay”

append remaining characters to pigWord

append suffix to pigWord

print “in Pig Latin, that’s ” pigWord

ask for next word

print sign-off message


Explanation / Answer

help me

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote