I've been working at this all weekend. I'm a n00b...don't make fun.
Obviously this works with a Tester class which is setup alright. The first object is supposed to Print only uppercase letters. I had it printing one uppercase letter and now it just returns the string. How can I print all uppercase letters? The second one is just printing the first letter. That's a far cry from printing every other letter. Anyone have any idea what I'm doing wrong on these things? I tremendously appreciate the help.
All the best,
Gene
//****************************************** // LetterAPI.java // Written by Sanchez // 2013 //******************************************* //=========================================== // Objects of this class manipulate an inputted string. //=========================================== import java.util.Scanner; //contains a set of methods for maniuplaing the string public class LetterAPI { //print only uppercase letters public static String bigLetters(String input) { String result = ""; char cl; for (int i = 0; i <input.length(); i++) { cl=input.charAt(i); if (Character.isUpperCase(cl)) input = input + cl; } return input; } //print every second letter public static String secondLetter(String input) { String result = ""; for (int i=0; i<input.length(); i+=2) { input = input + input.charAt(i) + " "; } return input; } //all vowels replaced by underscores public static String vowelsGone(String input) { String vowels ="aeiouAEIOU"; for (int i = 0; i<vowels.length();i++) { input=input.replace(vowels.charAt(i), '_'); } return input; } //the numbers of vowels public static String vowelNumber(String input) { String result = ""; int count = 0; for (int i = 0; i <input.length(); i++) { if (Character.toLowerCase(input.charAt(i)) == 'a' || Character.toLowerCase(input.charAt(i)) == 'e' || Character.toLowerCase( input.charAt(i)) == 'i' || Character.toLowerCase(input.charAt(i)) == 'o' || Character.toLowerCase(input.charAt(i)) == 'u') { count++; result = count + " "; } } return result; } //the positions of all vowels public static String vowelPositions(String input) { String result = ""; for (int i = 0; i <input.length(); i++) { if (Character.toLowerCase(input.charAt(i)) == 'a' || Character.toLowerCase(input.charAt(i)) == 'e' || Character.toLowerCase(input.charAt(i)) == 'i' || Character.toLowerCase(input.charAt(i)) == 'o' || Character.toLowerCase(input.charAt(i)) == 'u') { result = result + i + " "; } } return result; } }