Wednesday, March 18, 2009

Exer # 4

/*
Programmer Name: Jhovan C. Besas
Program Name: Name Echo
Purpose: To enhance how to run a program the name echo problems
Date: March 18,2009
Instructor: Dony Dongiapon
*/


import java.util.Scanner;
import java.io.*;
public class Echo {  

  public static void main(String[] args) throws IOException {

  System.out.print("Enter a Name: ");

 Scanner in=new Scanner(System.in);

 String words = in.nextLine();

 String reverse2="";

 String Word1=words.substring(words.indexOf(" "),

words.length()).toUpperCase();

 String Word2=words.substring(0,words.indexOf(" "));  
 System.out.println("Normal : " + words);
 System.out.println("Reverse: " +Word2+ " "+Word1); 
 }

}



No comments:

Post a Comment