Programming Shortcut

Write, Run and execute Your programs with simple and esay way by Programming Shortcut

Monday, February 4, 2019

Short name by java program

Hello Friends, Welcome to my blog

Today will write a program to the short name by java program, this problem is also asking in many ways they are following:
 1. Java Program to Convert a Person Name in Abbreviated.
 2. wap to print the short name of the user.
 3. Java program to convert full name to short name.
 4. Java program to a short name.
 5. Abbreviation of Java programming language.

 Problem:-
    Enter Name: Anant Deep Vishwakarma
        Output: A. D. Vishwakarma

 Solutions:-
    1. Store Name in a name String.
    2. Split Name String and Store to a temp string array.
    3. Find temp string array length store value in other variables.
    4. Take a loop to store all value to expect the last name and print the first character by value with
       dot or abbreviation.
    5. then print the last value of temp string all Character

 Explain:
    For example a store name 'Anant Deep Vishwakarma'in a name string and then split value into temp string array as temp[0]='Anant', temp[1]='Deep' and temp[2]='Vishwakarma', after that count length of temp string array and use loop to left the last index value last name 'Vishwakarma', in loop print first char of every index value within loop. in the last print last index of program

Best java program example:

    import java.util.*;
    class SName
    {
     public static void main(String[] args)
        {
            String n;
            Scanner c=new Scanner(System.in);
            System.out.print("Enter the user name:");
            n=c.nextLine();
            String [] t=n.split(" ");
            int l=t.length;
            System.out.print("Your Short name:");
            for(int i=0;i<l-1;i++)
            {
                System.out.print(t[i].charAt(0)+".");
            }
            System.out.print(t[l-1]);
         }
    }
     
I hope you understand the program is any query please comment below your query I reply your questions soon.
Bye..
       

Programming Shortcut is collections in java best programs with example, best c programs with example and best c++ programs with example, best way to learn java, c and c++

About Programming Shortcut

This is a programming learning website that can help you learn and when your write your programming code. And all programming code is compiled run programming code in the following programming language C, c++, Java, php and Javascript Languages. find your programming read, understand the programming then copy and past and run your program and save your golden time to typing the program becuse you learn more in leas time. All Programming is codeing is ease to understand the programming