Assignemnt #86

Code


/// Name: Daniel Nguyen
 /// Period: 6
 /// Program Name: lata Program
 /// File Name: lata.java
 /// Date Finished: 9/9/2015

// if you try defining a letter that doesnt exist with <= it will pull up an error
// it will return 2, the position of x is 2
// because it will be less than the threshold which will put up the final letter not the exact letter number place
//
import java.util.Scanner;

public class lata
{
	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
    
    

Picture of the output

Assignment 3
BACK HOME NEXT