Hi there,
I'm currently a student in an intro to Java course at the college level. I've been doing well all semester, but I've ran into trouble with our latest lab. It's a bonus lab, so naturally the content wasn't covered in class. After playing around with what I found in my textbook, I have a start but not much else.
Basically, it's a string analysis assignment and I'm sure its easy for most programmers. I'm a telecom student taking Java as opposed to a computer programming student taking java, so this stuff is a little more difficult for me.
After asking the user to enter some text and storing that text to a string variable while using a scanner object, I need to be able to output the following:
* The number of keystrokes in the string.
* The number of letters in the string.
* The number of upper-case and lower-case letters in the string.
* The number of digits in the string.
* The number of even and odd digits in the string.
So far, all I can do is output the number of keystrokes in the string. This is my program so far. I've been putting some serious time into this, but like I said, programming certainly doesn't come naturally for me. Otherwise I wouldn't be asking for help.
import java.util.*;
public class BonusLab
{
public static void main(String[] args)
{
Scanner keysIn = new Scanner(System.in);
System.out.print("Enter some text: ");
String str = keysIn.next();
System.out.println();
System.out.println("String Analysis:");
System.out.println("Keystrokes: " + str.length());
}
}
Any feedback would be much appreciated and thanks in advance
Rich