11-20-2003, 06:29 PM | #1 (permalink) | |
Insane
|
Java Question need help fast
I have a program that i need to make that takes input and then checks it for vowels and deletes the vowels then reoutputs the word with no vowels.. This is what I have so far:
Quote:
|
|
11-20-2003, 07:16 PM | #4 (permalink) |
Crazy
|
Whoa...slow down guys. Look at the existing code. First of all, you wanted to return something...so a void return is incorrect, and you wanted to take something in initially, so a parameter of nothing is also incorrect. Work on those things first. Then, cheerios' idea works perfectly.
__________________
"Even if you prove me wrong, I'm not going to believe you." - A. McGill |
11-20-2003, 08:19 PM | #5 (permalink) |
Junkie
Location: North Hollywood
|
Poster asked what was needed inside the if, not input/output
It has input already, take your own adivce without the code in the if, theres nothing to return, also they didnt say how the data is returned, only thats its output so a println maybe all thats needed, so a void type is fine. Also a StringBuffer will be much better than a String. |
11-20-2003, 08:57 PM | #6 (permalink) |
Crazy
Location: Iowa?
|
Code:
public class StringThing { public static String noVowel(String stringToUse) { String output = ""; for(int x = 0 ; x < stringToUse.length() ; x++) { char charToCheck = stringToUse.charAt(x); if (!(charToCheck == 'A' || charToCheck == 'E' || charToCheck == 'I' || charToCheck == 'O' || charToCheck == 'a' || charToCheck == 'e' || charToCheck == 'i' || charToCheck == 'o' || charToCheck == 'u')) { output = output + stringToUse.charAt(x); } } return output; } }
__________________
I should have been a pair of ragged claws Scuttling across the floors of silent seas. -The Love Song of J. Alfred Prufrock, T.S. Eliot Your dumber then me. |
Tags |
fast, java, question |
|
|