Hello Subash!
Here is the solution for the question you are asking for, I solved it in procedural way but if you are among the one who prefer OOP style then you can still ask it for me cause I have solved it from both methods but here I am just going to leave procedural one....
//author:Manish Acharya
import java.util.Scanner;
import java.util.*;
public class idgenerator {
public static void main(String[] args) {
String small_name="", long_name="", new_small_name="", new_long_name="";
char lr='a',...
This picture develops a clear understanding.

Yes, a physical quantity can have magnitude and direction but still be a scalar if it doesn't obey the vector addition. An example is Electric Current which has magnitude and a fixed direction, but it does not follow vector laws of addition.
Congratulations Sachin!!