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

Similar Threads

Help in hangman game 1
My Status, Ciphertext 2
Need Help: Program to Accept 2 Matrices and Show their Sum 0
Java matrix problem 3
Void problem 1
School Project 1
Java 1
Help With Java Program(s): Beginner 2

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,266
Latest member
DavidaAlla

Latest Threads

Top