Tuesday, 13 December 2016

Java Program to Convert a Person Name in Abbreviated

Problem:- Java program to abbreviate a given name or a java program to print short form of a name or Printing the initials of a Name or First letters of each word of a name or Write a Java Program to Convert a person's name in abbreviated or Java Program to Accept a name and print the short form of the name or Print initials of a name or how to find short form of a name in java or a java program to print short form of a name.


Explanation:- Abbreviated or sort name both are same, let's take an example and try to understand a sort name or abbreviated name, I am taking an example of my full name, My full name is " Ghanendra Pratap Singh Yadav " then my Abbreviated or Sort Name will be G. P. S. Yadav. I think now you understand the Abbreviated and sort name now comes to the problem. So for sort name and Abbreviated name as you can see above we have to print the first letter of your first name(in my case that is Ghanendra), and first letter of middle name(in my case that is Pratap Singh) and print the full last name(that is Yadav in my case).


Note:- Most people don't have a middle name so for them print the only first letter of the first name and last name Ie. The name is Ghanendra Yadav then sort name or Abbreviated name will be G. Yadav.


See Also:- C++ Program to Convert a person's name in abbreviated

Java Program to Print Short Form of a Name



import java.util.Scanner;
import java.io.*;
/* Program By Ghanendra Yadav
   Visit http://www.programmingwithbasics.com
*/
class abbreviated 
{ 
 public static void main(String[] args) throws IOException 
 {
  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

  System.out.print("\nEnter your Fisrt name:\t");
  char firstname=br.readLine().charAt(0);

  System.out.print("\nEnter middle Name:\t");
  char midname=br.readLine().charAt(0);

  System.out.print("\nEnter your last name:\t");
  String lastname=br.readLine();

  System.out.println("\n Abbreviated Name:\t"+firstname+"."+midname+"."+lastname);
 }
}

See Also:- C Program to Convert a person's name in abbreviated

Output:-

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment