Vowels - String n = ""; S for(int...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.*; public class Vowels { static Scanner console = new Scanner(System.in); public static void main(String[ ] args) { boolean validLetter = false; String [] validVowels = {"a","e","i","o","u"}; String [] validName = { "Albert","Eddy","Ike","Otis","Umi"}; S String s; System.out.println("Enter a Vowel"); s = console.next();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: String n = ""; S for(int x = 0;x<validVowels.length;++x) { if(s.equals(validVowels[x])) { validLetter = true; n = validName[x]; }} if(validLetter) System.out.println("The String is Correct,You have entered the Vowel " + s + ":" + n); else System.out.println("Invalid Entry!!"); }} }...
View Full Document

Ask a homework question - tutors are online