Hey I am having a problem with this java program im trying to accomplish.... I know how to count the characters or letters in a word, but how do you count every other word and display that letter in a row. Im trying to do an encryption program for example if i input Hiehlrluo, it should display Hello. here is my code i have it coded to count the letters... Any help would be great.
/**
* @(#)Week_four_number_67.java
*
* Week_four_number_67 application
*
* @author
* @version 1.00 2012/2/2
*/
import javax.swing.JOptionPane;
public class Week_four_number_67
{
public static void main(String[] args)
{
String Sentence = JOptionPane.showInputDialog(null,"Please input Your encrypted Sentance");
int count1 = 0;
for (int i = 0; i < Sentence.length(); i++)
{
if (Character.isLetter(Sentence.charAt(i)))
count1++;
}
JOptionPane.showMessageDialog(null,""+count1);
}
}