Can someone help me with this? code: public class PigLatinator { /** * Takes a character array and arranges the characters into it's pig-latin form * * The rules for pig-latin are as follows: * 1. If a word starts with a consonant, search through the word beginning at index 0 for the first * instance of a vowel. Split the array at this vowel, moving the consonants to the back of the array, * following a '-'. The add 'ay' at the end of the word. * 2. If a word starts with a vowel add the word "yay" at the end of the word following a '-'. * 3. If a word contains no vowels, just add "ay" at the end of the word following a '-'. * 4. If input is null, return null. * * Hint: Use your isVowel method to cut down on repetitive code * NOTE: Do not use string methods to rearrange your arrays; you should use the indexes * * Example: char[] input = {'h', 'e', 'l', 'l', 'o'} gives * char[] output = {'e', 'l', 'l', 'o', '-', 'h', 'a', 'y'} * char[] input = {'f', 'l', 'a', 'r', 'e'} gives * char[] output = {'a', 'r', 'e', '-', 'f', 'l', 'a', 'y'} * char[] input = {'i', 't'} gives * char[] output = {'i', 't', '-', 'y', 'a', 'y'} * char[] input = {'s', 'h', 'h'} gives * char[] output = {'s', 'h', 'h', '-', 'a', 'y'} * * * @param input The char array to rearrange to pig-latin. * @return A new char array containing the pig-latin of input. If input is null, return null. */ public static char[] pigLatin(char[] input) { return null; } /** * This method is to transform words that begin with a consonant into pig-latin. * If a word starts with a consonant, search through the word beginning at index 0 for the first * instance of a vowel. Split the array at this vowel, moving the consonants to the back of the array, * following a '-'. Then add 'ay' at the end of the word. * If a word contains no vowels, just add "ay" at the end of the word following a '-'. * NOTE: Do not use string methods to rearrange your arrays; you should use the indexes * * @param input - The char array to rearrange to pig-latin. * @return A new char array containing the pig-latin of input. */ public static char[] startsConsonant(char[] input) { return null; } /** * This method is to transform words that begin with a vowel into pig-latin. * If a word starts with a vowel add the word "yay" at the end of the word following a '-'. * NOTE: Do not use string methods to rearrange your arrays; you should use the indexes * * @param input - The char array to rearrange to pig-latin. * @return A new char array containing the pig-latin of input. */ public static char[] startsVowel(char[] input) { return null; } /** * Takes a letter, and checks if it is a vowel, then returns true is yes, false if no. * * Vowels are: a, e, i, o, u * (Note: We are not considering y for this program.) * * @param letter, the letter being checked if it is a vowel * @return A boolean, true if letter is vowel, otherwise false */ public static boolean isVowel(char letter) { return false; } /** * This is test method for the pigLatin() method * * This method already contains 3 tests, but you should consider adding more to * test different input. * */ public static void testPigLatin() { char arr[] = {'f', 'l', 'a', 'r', 'e'}; char arr2[] = {'b', 'o', 'o', 'k'}; char arr3[] = {'i', 't'}; System.out.print("Expected: are-flay\nActual: "); System.out.println(pigLatin(arr)); System.out.print("Expected: ook-bay\nActual: "); System.out.println(pigLatin(arr2)); System.out.print("Expected: it-yay\nActual: "); System.out.println(pigLatin(arr3)); } /** * This is the main method of your program. This is where we will call our test method. * * @param args */ public static void main(String[] args) { testPigLatin(); } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Can someone help me with this?

code:

public class PigLatinator
{

/**
* Takes a character array and arranges the characters into it's pig-latin form
*
* The rules for pig-latin are as follows:
* 1. If a word starts with a consonant, search through the word beginning at index 0 for the first
* instance of a vowel. Split the array at this vowel, moving the consonants to the back of the array,
* following a '-'. The add 'ay' at the end of the word.
* 2. If a word starts with a vowel add the word "yay" at the end of the word following a '-'.
* 3. If a word contains no vowels, just add "ay" at the end of the word following a '-'.
* 4. If input is null, return null.
*
* Hint: Use your isVowel method to cut down on repetitive code
* NOTE: Do not use string methods to rearrange your arrays; you should use the indexes
*
* Example: char[] input = {'h', 'e', 'l', 'l', 'o'} gives
* char[] output = {'e', 'l', 'l', 'o', '-', 'h', 'a', 'y'}
* char[] input = {'f', 'l', 'a', 'r', 'e'} gives
* char[] output = {'a', 'r', 'e', '-', 'f', 'l', 'a', 'y'}
* char[] input = {'i', 't'} gives
* char[] output = {'i', 't', '-', 'y', 'a', 'y'}
* char[] input = {'s', 'h', 'h'} gives
* char[] output = {'s', 'h', 'h', '-', 'a', 'y'}
*
*
* @param input The char array to rearrange to pig-latin.
* @return A new char array containing the pig-latin of input. If input is null, return null.
*/
public static char[] pigLatin(char[] input)
{

return null;
}

/**
* This method is to transform words that begin with a consonant into pig-latin.
* If a word starts with a consonant, search through the word beginning at index 0 for the first
* instance of a vowel. Split the array at this vowel, moving the consonants to the back of the array,
* following a '-'. Then add 'ay' at the end of the word.
* If a word contains no vowels, just add "ay" at the end of the word following a '-'.
* NOTE: Do not use string methods to rearrange your arrays; you should use the indexes
*
* @param input - The char array to rearrange to pig-latin.
* @return A new char array containing the pig-latin of input.
*/
public static char[] startsConsonant(char[] input) {

return null;
}

/**
* This method is to transform words that begin with a vowel into pig-latin.
* If a word starts with a vowel add the word "yay" at the end of the word following a '-'.
* NOTE: Do not use string methods to rearrange your arrays; you should use the indexes
*
* @param input - The char array to rearrange to pig-latin.
* @return A new char array containing the pig-latin of input.
*/

public static char[] startsVowel(char[] input) {

return null;
}
/**
* Takes a letter, and checks if it is a vowel, then returns true is yes, false if no.
*
* Vowels are: a, e, i, o, u
* (Note: We are not considering y for this program.)
*
* @param letter, the letter being checked if it is a vowel
* @return A boolean, true if letter is vowel, otherwise false
*/
public static boolean isVowel(char letter)
{

return false;
}

/**
* This is test method for the pigLatin() method
*
* This method already contains 3 tests, but you should consider adding more to
* test different input.
*
*/
public static void testPigLatin()
{
char arr[] = {'f', 'l', 'a', 'r', 'e'};
char arr2[] = {'b', 'o', 'o', 'k'};
char arr3[] = {'i', 't'};



System.out.print("Expected: are-flay\nActual: ");
System.out.println(pigLatin(arr));
System.out.print("Expected: ook-bay\nActual: ");
System.out.println(pigLatin(arr2));
System.out.print("Expected: it-yay\nActual: ");
System.out.println(pigLatin(arr3));


}

/**
* This is the main method of your program. This is where we will call our test method.
*
* @param args
*/

public static void main(String[] args)
{
testPigLatin();
}
}

8.17 **zyLab: Pig-Latin
Write this program using an IDE. Comment and style the code according to the CS 200 Style Guide. Submit the source code files (.java)
below. Make sure your source files are encoded in UTF-8. Some strange compiler errors are due to the text encoding not being correct.
This program will translate a word into pig-latin. Pig-latin is a language game in which words in English are altered, usually by removing
letters from the beginning of a word and arranging them into a suffix.
The rules we will use for the pig-latin in this program are as follows:
1. If a word starts with a consonant, split the word at the first instance of a vowel, moving the beginning consonants to the end of the
word, following a''. Then add 'ay' at the end of the word. Vowels are: a, e, i, o, u (Notice: We are not considering y a vowel for this
program)
2. If a word starts with a vowel add the word "yay" at the end of the word following a '-'.
Examples:
• hello translates to ello-hay
• flare translates to are-flay
• it translates to it-yay
A more detailed explanation of the requirements for each method will be in the method header comments - please follow these closely.
Suggested order of completion: isVowel() then pigLatin().
Created by India Archer.
Spring 2021: Revised by Taylor Mehmen. Reviewed by Dakota Sullivan.
10/27 jimw Dropped isVowel Method call test since acceptable implementations wouldn't pass. 10/28 apk Updated pigLatin unit test to
improve consistency of test feedback for methods with undesirable side effects (i.e. modifying the input array).
295530.1815300.qx3zqy7
Transcribed Image Text:8.17 **zyLab: Pig-Latin Write this program using an IDE. Comment and style the code according to the CS 200 Style Guide. Submit the source code files (.java) below. Make sure your source files are encoded in UTF-8. Some strange compiler errors are due to the text encoding not being correct. This program will translate a word into pig-latin. Pig-latin is a language game in which words in English are altered, usually by removing letters from the beginning of a word and arranging them into a suffix. The rules we will use for the pig-latin in this program are as follows: 1. If a word starts with a consonant, split the word at the first instance of a vowel, moving the beginning consonants to the end of the word, following a''. Then add 'ay' at the end of the word. Vowels are: a, e, i, o, u (Notice: We are not considering y a vowel for this program) 2. If a word starts with a vowel add the word "yay" at the end of the word following a '-'. Examples: • hello translates to ello-hay • flare translates to are-flay • it translates to it-yay A more detailed explanation of the requirements for each method will be in the method header comments - please follow these closely. Suggested order of completion: isVowel() then pigLatin(). Created by India Archer. Spring 2021: Revised by Taylor Mehmen. Reviewed by Dakota Sullivan. 10/27 jimw Dropped isVowel Method call test since acceptable implementations wouldn't pass. 10/28 apk Updated pigLatin unit test to improve consistency of test feedback for methods with undesirable side effects (i.e. modifying the input array). 295530.1815300.qx3zqy7
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education