/*
Exercise 4
Program Name:NAME ECHO
Programmer name: Danver G. Palmiano
Date Started: March 18,2009, 9:15am
Date Ended: March 18, 2009,1:24pm
Aim: When enter two word second word will turn to capital letter or in upper case form.
*/
import java.util.Scanner;
import javax.swing.*;
import java.io.*;
public class nameEcho{
public static void main(String[] args) throws IOException//start the main method that will catch Exceptions
{
String b;//first input string
String c;//second input string
String a=JOptionPane.showInputDialog("Enter your Name: ");//ask input to the user in correct form
b=a.substring(a.indexOf(" "),a.length()).toUpperCase();// uppercase method
c=a.substring(0,a.indexOf(" "));
System.out.println("Input in normal form : " + a);// Print the normal string
System.out.println("Output: " +c+ " "+b);// Print the string in normal and in Uppercase
}//end main method
}//end class nameEcho
Sample Output:
Enter name: dan ver
Input in Normal Form: dan ver
Output: dan VER
source:SAVITCH, WALTER"Java: AN INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING",THIRD EDITION
Wednesday, March 18, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment