VB icon

First Letter Capital Program

Email
Submitted on: 8/4/2015 10:40:34 PM
By: Jake R. Pomperada  
Level: Intermediate
User Rating: Unrated
Compatibility: Java (JDK 1.1), Java (JDK 1.2), Java (JDK 1.3), Java (JDK 1.4), Java (JDK 1.5)
Views: 3474
author picture
 
     As I continue my study on Java I have discovered that Java programming language has many built in functions that makes programming much easier and more fun specially we are working with strings. I enjoy every minute working with Java. No wonder there are many programmers, developers and software engineers find it very useful in many programming project because it is a very versatile programming language. In this article I would like to share with you guys a sample program that I wrote in Java that will ask the user to give a sentence and then our program will convert the first letter of the sentence into uppercase letter. I have created a method on it that well convert the first letter of the word in a give sentence by our user. In addition our program it will ask the user if the user would want to repeat the program running by asking the user do you want to continue yes or not. If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.comand jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360. Thank you very much and Happy Programming.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: First Letter Capital Program 
// Description:As I continue my study on Java I have discovered that Java programming language has many built in functions that makes programming much easier and more fun specially we are working with strings. I enjoy every minute working with Java. No wonder there are many programmers, developers and software engineers find it very useful in many programming project because it is a very versatile programming language.
In this article I would like to share with you guys a sample program that I wrote in Java that will ask the user to give a sentence and then our program will convert the first letter of the sentence into uppercase letter. I have created a method on it that well convert the first letter of the word in a give sentence by our user. In addition our program it will ask the user if the user would want to repeat the program running by asking the user do you want to continue yes or not.
 
If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.comand jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360.
Thank you very much and Happy Programming.
// By: Jake R. Pomperada
//**************************************

// find_upper_case.java
// Programmer : Mr. Jake R. Pomperada, MAED-IT
// Date: August 5, 2015
// Tools : Netbeans 8.0.2
// Email : jakerpomperada@yahoo.com and jakerpomperada@gmail.com
// Write a program that will conver the first letter of a word into capital
// letters
 import java.util.Scanner; 
 public class find_upper_case { 
public static String Upper_First_Letter(String str) 
{
boolean check_space = true;
char[] chars = str.toCharArray();
for (int a = 0; a < chars.length; a++) {
if (Character.isLetter(chars[a])) {
if (check_space) {
chars[a] = Character.toUpperCase(chars[a]);
}
check_space = false;
} else {
check_space = Character.isWhitespace(chars[a]);
}
}
return new String(chars);
}
 
public static void main(String[] args) {
 Scanner input = new Scanner(System.in);
 char ch;
 do { 
 String sentence,repeat;
 repeat = input.nextLine(); 
 System.out.print("FIRT LETTER CAPITAL PROGRAM");
 System.out.println();
 System.out.print("Enter a Sentence : ");
 sentence = input.nextLine();
 System.out.println();
 System.out.println("ORIGINAL SENTENCE");
 System.out.print(sentence);
 System.out.println("\n\n");
 System.out.println("CONVERTED SENTENCE");
 System.out.print(Upper_First_Letter(sentence));
 System.out.println();
 System.out.print("\nDo you want to continue (Type y or n) : ");
 ch = input.next().charAt(0);
 } while (ch == 'Y'|| ch == 'y'); 
 System.out.println();
 System.out.print("\t THANK YOU FOR USING THIS PROGRAM"); 
 System.out.println();
}
}


Other 53 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.