Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; public class PigLatin { public static void main (String[] args){ Scanner scan = new Scanner(System.in); String input = scan.nextLine(); String[] input = translate(input);

image text in transcribed

import java.util.Scanner;

public class PigLatin { public static void main (String[] args){ Scanner scan = new Scanner(System.in); String input = scan.nextLine(); String[] input = translate(input); print(input); } public static String[] translate(String[] input) { String[] pigLatin = new String[input.length]; for (int i = 0; i 0 && c == 'y') return i; i++; } return -1; } public static boolean isVowel(char c) { if( c =='a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') // checks if character is a vowel return true; else return false; } public static void print(String[] input){ for (int i = 0; i

my code is wrong and doesnt allow input of sentences

Task Rules of Translation: If the word begins with a consonant, take the beginning consonants up until the first vowel and move them to the end of the word Then append ay at the very end. (so cricket would become icketcray) If the word begins with a vowel, simply add ay to the end. (apple would become appleay) If y is the first letter in the word, treat it as a consonant, otherwise it is used as a vowel. (young would become oungyay and system would become ystemsay) Assume all nput is lowercase and alphabetical (so don't worry about checking for casingumbers/symbols) The main method should have as few lines code as possible, and the template has suggested method headers. Feel free to rename variables and methods in a way that makes sense for you, but keep the general format

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

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions