Prog 86: Letter at a Time

///Name: Ilana Levy
///Period: 5
///Program Name: Lettar at a Time
///File Name: letterTime.java
///Date Finished: 9/28/2015

import java.util.Scanner;

public class letterTime
{
        public static void main( String[] args )
        {
                Scanner kb = new Scanner(System.in);

            System.out.print("What is your message? ");
            String message = kb.nextLine();

            System.out.println("\nYour message is " + message.length() + " characters long.");
            System.out.println("The first character is at position 0 and is '" + message.charAt(0) + "'.");
            int lastpos = message.length() - 1;
            System.out.println("The last character is at position " + lastpos + " and is '" + message.charAt(lastpos) + "'.");
            System.out.println("\nHere are all the characters, one at a time:\n");

            for ( int i=0; i< message.length(); i++ )
            {
                System.out.println("\t" + i + " - '" + message.charAt(i) + "'");
            }

            int a_count = 0;

            for ( int i=0; i< message.length(); i++ )
            {
                char letter = message.charAt(i);
                if ( letter == 'a' || letter == 'A' || letter == 'e' || letter =='E' || letter == 'i' || letter == 'i' || letter == 'I' || letter == 'o' || letter == 'O' || letter == 'u' || letter == 'U'  )
                {
                    a_count++;
                }
            }

            System.out.println("\nYour message contains the vowels " + a_count + " times. Isn't that interesting?");



        }
}
//1. There is an error message as an additional letter or symbol does not exist and therefore the computer cannot understand it.
//2. the length() is 3 but the x is in the 2 position.
//3. message.length begins at 0 instead of 1. Therefore the values for length are all shifted down by 1 ( 1 = 0, 2 = 1, etc ) in counting position. If every value of length is down by 1, then the positioning cannot go to the full length; it can only go to the length - 1. Therefore, i must be less than the length