Basic Java program

Joined
Jul 9, 2009
Messages
1
Reaction score
0
I have this incomplete program:
import java.util.Scanner; //imports Scanner class
public class StringCounter
{
public static void main(String[] args)
{
Scanner keyin = new Scanner(System.in);
String word;
String usersChoice;
int position = 0;
int choice = 0;
int tally = 0;
System.out.print("Please enter a word: ");
word = keyin.next();
System.out.print("Please enter a character. ");
usersChoice = keyin.next();

}
}

It is suppose to ask a user for a string and then a character and then will count how many times that character appears in the string. Must have a while loop in it.
It is basic CIS 111 program but I have no clue on how to go about doing this. if there is anyone out there who can give me a clue on how to continue please help me. Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top