I'm using xCode (FYI). This program accepts input via JOptionPane.showInputDialog() and tells the user how many upper/lower case letters there were using a JOptionPane.showMessageDialog(). It repeats this process until the user types the word "Stop".
Here's my code
I get 6errors here, 4 Unclosed character literal, 1 ')' expected, and 1 "Command /Developer/jam failed with exit code 1
Any ideas? Once this part is done, the rest should be a snap, just a matter ading an else() to the loop...right? Thanks!
Here's my code
Code:
//
//
import javax.swing.*;
public class Project0 {
public static void main (String args[])
{
String line = JOptionPane.showInputDialog("Enter a line of text:");
JOptionPane.showMessageDialog(null, "Your string contains "
+ lowercaseCount(line)
+ " lowercase letters.");
System.exit(0);
}
public static int lowercaseCount(String line)
{
int count = 0;
for ( int i = 0; i < line.length(); i++ )
{
char x = line.charAt(i);
if ( x >= '65' && x <= '90' )
count++;
}
return count;
}
}
I get 6errors here, 4 Unclosed character literal, 1 ')' expected, and 1 "Command /Developer/jam failed with exit code 1
Code:
if ( x >= '65' && x <= '90' )
count++;