Alright, so here is my dilemma. Unfortunately my Java teacher does not teach how to start the projects in class, nor does he tell us where to find the information to start the program. This is my first programming course, so I'm still trying to learn a few things.
So, lets get to the point, he wants it to look like this:
This program is written by Ben Barcomb
Enter a String: Alaska
Number of A: 3
//End of program
That is it. I just don't know where to start. Any help would be greatly appreciated! This is what I have right now. The program ends after I enter Alaska.
import java.util.Scanner;
public class P4_BenjaminBarcomb
{
public static void main(String[] args)
{
System.out.println("This program is written by Benjamin Barcomb\n");
Scanner kb = new Scanner(System.in);
int counter = 0;
System.out.print("Enter a String: ");
String word = kb.next();
for (int i = 0; i < word.length(); i++) {
if (word.substring(i, i+1).equalsIgnoreCase("a"))
counter++;
}
}
}