So im new to coding and i am having some issues... My program is supposed to ask the user for input, and will need to assume that all the input is lowercase... and need to assume there are no extra spaces, and will need to assume it ends with a period. The program will then translate the text into pig latin... Just incase you need the rules for pig latin they are if the word beging with a vowel, add a dash and "way" to the end... Otherwise, add a dash move the first letter to the end, and add "ay"... Now i know my code can be better but i just want to get it running first and then change it if i need too. So my issue is that the code runs but it will not print out any text besides the first word. And the other text has to also be in pig latin, i have pasted the code before. So any help would be awesome... Thanks.
import java.util.Scanner;
public class Piglat{
public static void main(String [] args) {
Scanner scanner = new Scanner(System.in);
String text, pigLatin;
char first;
System.out.print("Enter a line of text: ");
text= scanner.next();
first = text.charAt(0);
if (first == 'a' || first == 'e' || first =='i'||
first == 'o' || first == 'u')
pigLatin = text + "-way";
else
pigLatin = text.substring(1) + "-" + text.charAt(0) + "ay";
System.out.println("Input : " + text);
System.out.print("Output: " + pigLatin);
}
}
My output
Enter a line of text: this is a text.
Input : this
Output: his-tay