Friday, March 20, 2009

Assignment No4: Name Echo

Exer #4: Name Echo

Programmer: Dongiapon, Jenelyn
Program name: Name Echo
Purpose: To Learned how to program the name echo problems
Date: March 20,2009
Instructor: Dony Dongiapon

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


public static void main(String[] args) throws IOException
{
// 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