1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ira [324]
3 years ago
11

Pig Latin is a nonsense language. To create a word in pig Latin, you remove the first letter and then add the first letter and "

ay" at the end of the ford. For example, "dog" becomes "ogday" and "cat" becomes "atcay". Write a program named PigLatin that allows the user to enter a word and display’s the pig Latin version. For words which begin with vowel sounds or silent letter, one just adds "yay" to the end. Examples are:  "eat" → "eatyay"  "omelet" → "omeletyay"  "are" → "areyay" Another less common way some speakers may use a different ending for words starting with vowels is adding "way" (or "wa") to the end. Examples are:  "egg" → "eggway"  "inbox" → "inboxway"  "eight" → "eightway" You could use the split command to enter more than one word. Indicating delimiters char[] delimiterChars = { ' ', ',', '.', ':', ';', '\t' }; string[] words = text.Split(delimiterChars);
Computers and Technology
1 answer:
LUCKY_DIMON [66]3 years ago
7 0

Answer:

Hi there  Sandrathompson5661!  

Using Java as the language for implementation, the PigLatin translation program can simply be coded as shown below. The program uses the Scanner module in java utils package to prompt the user for input of word(s) and splits the input with any of the matching delimiters. The rule to swap the first character and append it to the end with an “ay” for a normal word, or the appending of “yay” for a vowel word, is then applied. The result is printed on the screen before the program exits.

Explanation:

import java.util.Scanner;

public class PigLatin {    

 public static void main(String[] args)     {        

   char[] delimiterChars = { ' ', ',', '.', ':', ';', '\t' };        

   String[] words_array;        

   Scanner words = new Scanner(System.in);        

   System.out.println("Please enter a word (for multiple words use any of the following delimiters {' ', ',', '.', ':', ';', '\t' }): ");        

   String input_words = words.nextLine();        

   words_array = input_words.split("[,\\s\\-:.;' '\\\t]");  

   System.out.println("PigLatin translation: ");        

   for (int i=0; i<words_array.length; i++) {

     System.out.println(makePigLatin(words_array[i]));        

   }    

 }      

 public static String makePigLatin(String word)     {        

    String vowels = "aeiou";        

    if (vowels.indexOf(Character.toLowerCase(word.charAt(0))) != -1) {          

       word = word + "yay";        

    }        

    else {          

       word = word.substring(1, word.length()) + word.charAt(0) + "ay";        

    }        

    return word;      

 }

}

You might be interested in
Consider the following class, which models a bank account. The deposit method is intended to update the account balance by a giv
Sav [38]

Answer:

the variable balance is declared as a local variable and is different from the instance variable balance.

Explanation:

In this code, the deposit method is not working as intended because the variable balance is declared as a local variable and is different from the instance variable balance. This is occurring due to the keyword double being placed before the balance variable within the deposit method. This is basically creating a new variable called balance that is only targetable by the local scope within the deposit method. Removing this keyword would instead target the class instance variable balance which is what is needed. In this case, the balance local variable being created is always null and would cause the method to not function.

7 0
3 years ago
You are an administrator of a growing network. You notice the network you have created is broadcasting, but you cannot ping syst
Nonamiya [84]

Answer:

Network bridge

Explanation:

You are an administrator of a growing network. You notice the network you have created is broadcasting but you cannot ping systems on different segments of your network. What device should you use to fix this issue?

✓ Network bridge

3 0
2 years ago
Edhesive AP Computer Science Coding Activity 2:
Romashka-Z-Leto [24]

Answer:

The method in C++ is as follows:

double average(int v, int w, int x, int y, int y){

   double ave = (v+w+x+y+z)/5.0;

   return ave;

}

Explanation:

This defines the average method with 5 parameters

double average(int v, int w, int x, int y, int y){

This calculates the average

   double ave = (v+w+x+y+z)/5.0;

This returns the calculated average

   return ave;

}

To call the method from the program's main, use:

<em>int main(){</em>

<em>    cout<<average(1,5,7,4,10);</em>

<em>    return 0;</em>

<em>}</em>

<em />

7 0
3 years ago
What are the 7 c s of communication​
Hatshy [7]

Answer: the answer is A.

Explanation: hope this helps!

5 0
3 years ago
WILL GIVE BRAINLIEST
malfutka [58]

Answer:

25

Explanation:

259÷10=25

4 0
3 years ago
Read 2 more answers
Other questions:
  • Consider the following two implementations of the same algorithm, each written in a different language.
    11·1 answer
  • What is the output of the code snippet given below? string s = "aeiou"; int i = 0; do { system.out.print(s.substring(i, i + 1));
    12·1 answer
  • Which event occurs when the user clicks on an html element?
    9·1 answer
  • Which of the following is necessary to effectively navigate online?. A. You must be able to identify important questions. B. You
    12·1 answer
  • Which of the following is an example of a consumer
    14·2 answers
  • In which of the following work situations would word processing software be most appropriate to make the task easier?
    6·1 answer
  • Handouts are pages of your presentation that you print and distribute to your audience
    10·1 answer
  • Which part of the Word application window should the user go to for the following activities?
    14·1 answer
  • How does one of the algorithms in your program function?
    13·1 answer
  • Which of the following is/are used in multimedia?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!