Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task: Write a program called PigLatin which repeatedly prompts the user for a word and prints out the Pig Latin version of that word. The

Task: Write a program called PigLatin which repeatedly prompts the user for a word and prints out the Pig Latin version of that word. The program should stop when the user enters "stop". (Do not convert "stop" to Pig Latin.)

Steps: Your program must contain the following elements:

A function called isVowel which takes a character (type char) as a parameter and returns true if the character is a vowel and false if it is not. Vowels are the letters a, e, i, o, and u.

A function called findFirstVowel which takes a string as a parameter and returns the position of the first vowel occurring in the string, or -1 if there are no vowels in the string. Counting should start at 0 (like arrays), so the function should return 0 for "apple" and "orange", 1 for "cat" and "dog", 3 for "scratch", and -1 for "xyzzy". The function should go through the characters of the string one at a time and determine if each is a vowel or not. (Do not find some alternative method for locating the position of the first vowel.)

A function called pigifyWord which takes a string representing a single word as a parameter, and returns the Pig Latin version of that string. (Don't print it!)

A main program which repeatedly prompts the user for a word and prints out the Pig Latin version of that word. The program should stop when the user enters "stop". (Do not convert "stop" to Pig Latin.)

Call the various subroutines and functions as appropriate: findFirstVowel should use isVowel to determine if a particular character is a vowel or not, pigifyWord should use findFirstVowel to find the position of the first vowel in the word so you can determine how to pigify it, and main should use pigifyWord to convert each word to Pig Latin.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions