Tuesday, March 17, 2009

Exercise #4---name Echo

Exercise #4---name Echo

ProgrammerName: Odoy, Montanio
ProgramName: Name Echo
Purpose: To Learned how to program the name echo problems
Date: March 17,2009
Instructor: Dony Dongiapon

import java.util.Scanner;
import java.io.*;
public class reverse {
   
 
  public static void main(String[] args) throws IOException
  {
  // The normal sentence that is going to be reversed.
  System.out.print("Enter 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(" "));
   
  // Print the normal string
  System.out.println("Normal : " + words);
 // Print the string in reversed order
  System.out.println("Reverse: " +Word2+ " "+Word1);
  }

}

No comments:

Post a Comment