Computers and Technology

BJP5 Exercise 6.20: pigLatin Language/Type: Java file processing Scanner
Author:Marty Stepp (on 2019/09/19)

Write a method called pigLatin that accepts as a parameter a Scanner representing an input file. Your method should, preserving line breaks, print out the input file's text in a simplified version of Pig Latin, a silly English variant where the first letter of each word is moved to the end. Our rules for translating a word to Pig Latin are as follows:

If the word starts with a vowel (a, e, i, o, or u), append "yay". For example, "elephant" becomes "elephantyay".
If the word starts with a consonant, move the consonant to the end, and append "ay". For example, "welcome" becomes "elcomeway".
You should also convert every word to lowercase. For example, if the input file contains the following text:

Shall I compare thee to
a summer's day Thou art more
lovely and more temperate
For the preceding input, your method should produce the following console output:

hallsay iyay omparecay heetay otay
ayay ummer'ssay ayday houtay artyay oremay
ovelylay andyay oremay emperatetay

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 16:30, vitothebest1
You have read about the beginnings of the internet and how it was created. what was the internet originally created to do? (select all that apply) share research. play games. communicate. share documents. sell toys
Answers: 1
image
Computers and Technology, 23.06.2019 22:50, atifgujar
An environmental protection agency study of 12 automobiles revealed a correlation of 0.47 between engine size and emissions. at 0.01 significance level, can we conclude that there is a positive association between the variables? what is the p value? interpret.
Answers: 2
image
Computers and Technology, 24.06.2019 22:30, anselmojohn4370
Distinguish between a skill resume and a chronological resume and explain when it is best to use each format
Answers: 1
image
Computers and Technology, 25.06.2019 05:10, mathbrain58
Write a program that asks for 'name' from the user and then asks for a number and stores the two in a dictionary (called 'the_dict') as key-value pair. the program then asks if the user wants to enter more data (more data (y/n)? ) and depending on user choice, either asks for another name-number pair or exits and stores the dictionary key, values in a list of tuples and prints the list. note: ignore the case where the name is already in the dictionary. example: name: pranshu number: 517-244-2426 more data (y/n)? y name: rich number: 517-842-5425 more data (y/n)? y name: alireza number: 517-432-5224 more data (y/n)? n [('alireza', '517-432-5224'), ('pranshu', '517-244-2426'), ('rich', '517-842-5425')]
Answers: 3
Do you know the correct answer?
BJP5 Exercise 6.20: pigLatin Language/Type: Java file processing Scanner
Author:Marty Stepp (...

Questions in other subjects:

Konu
Mathematics, 14.02.2020 02:04