The problem is to create a Java program that will ask the user to input any type of String values via command line. The output should contain the args[i] value, the length of the inputted String, the actual String and the type of character of the last character of the inputted String. The types of characters are as follows: vowels, consonants, numbers and symbols. The only time you can consider a certain character as a symbol is when it is not a vowel, nor a consonant nor a number. Here’s a sample IO:
Well this looks like an assignment but let's see what we can do to help you figure this out and learn from it.
Is your code building and are you using an ide to debug it or are you using a text editor?
What is it currently doing?
EDIT: I'll give you your first hint, check your while statement syntax. After that you'll start seeing something....
My first question would be: You're starting out with case statements for the lowercase vowels, but then you abandon that approach in the default section for something rather unwieldy with lots of if statements; why are you not using case statements for ALL possible cases?
i am not convinced the last hint is going to be very helpful.
You appear to be confusing the command‑line arguments with text input at runtime. Which are you going to use?
You have also goo far too long a method. You should divide that into getting input, finding the last character, and determining its type.
You do realise that a char is not a letter? It is a number, and you can therefore find ranges of numbers, do arithmetic with them, etc.
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
a bit of art, as a gift, that will fit in a stocking