Pattern of your own name.
Pattern program of your own name.
This is a pattern program, in this program you just have to enter your name and it will give you output in a particular manner. I have created this program when I was in class 10th for my Computer Application project.
NOTE: If you are copying my code then its a advise to you to copy it after downloading it to avoid any kind of compilation error its link is available at the bottom of source code.
SOURCE CODE
import java.io.*;
public class Patter_of_your_Own_Name
{
public static void main(String args[])throws IOException
{
int time=1;
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
do
{
System.out.print("\n\t\t\tPLEASE,ENTER YOUR GOOD NAME
IN CAPITAL LETTER :");
String str=br.readLine();
while(flag<str.length())
{
for(int i=0;i<str.length();i++)
{
char ch=str.charAt(i);
if(Character.isUpperCase(ch)||ch==' ')
flag++;
}
if(flag<str.length())
{
System.out.println("\n\t\t\t$$$$$$$ = SORRY,IT IS IN
SMALL LETTER, TRY AGAIN = $$$$$$$");
System.out.print("\n\t\t\tPLEASE,ENTER YOUR GOOD NAME
IN CAPITAL LETTER :");
str=br.readLine();
}
}
int zz=0,zz1=0,zz2=0,n=0;
do
{
System.out.print("\n\t\t\tENTER FONT SIZE >=5 IT
MUST BE AN ODD NUMBER :");
n=Integer.parseInt(br.readLine());
if(n>=5)
{
zz1=1;
}
if(n%2!=0)
{
zz2=1;
}
if(zz1==1 && zz2==1)
zz=1;
}
while(zz==0);
int a=n/2+1;//This variable is use by all pattern
int m=1,Qfreq=0;//This variable is use by 'Q' pattern
int k2=1,Rfreq=0;//This variable is used by 'R' pattern
int s=-a,l=n+a-1,Vfreq=0;//This variablE is used by 'V'
pattern
int k4=0,Xfreq=0;//This variable is use by 'X' pattern
int WW=0,Wfreq=0;//This variable is use by 'W' pattern
int EE=0,Mfreq=0;//This variable is use by 'M' pattern
int k5=n,Yfreq=0;//This variable is used by 'Y' pattern
int s1=n,t=1,s2=3,t2=a+1,Kfreq=0;
char ar[]=new char[str.length()];
for(int i=0;i<str.length();i++)
{
ar[i]=str.charAt(i);
}
//Now,here we count the frequecy of variables
'K','M','Q','R','V','W','X','Y'
System.out.println("\n");
for(int i=0;i<str.length();i++)
{
if(ar[i]=='K')
Kfreq++;
}
for(int i=0;i<str.length();i++)
{
if(ar[i]=='M')
Mfreq++;
}
for(int i=0;i<str.length();i++)
{
if(ar[i]=='Q')
Qfreq++;
}
for(int i=0;i<str.length();i++)
{
if(ar[i]=='R')
Rfreq++;
}
for(int i=0;i<str.length();i++)
{
if(ar[i]=='V')
Vfreq++;
}
for(int i=0;i<str.length();i++)
{
if(ar[i]=='W')
Wfreq++;
}
for(int i=0;i<str.length();i++)
{
if(ar[i]=='X')
Xfreq++;
}
for(int i=0;i<str.length();i++)
{
if(ar[i]=='Y')
Yfreq++;
}
//Created By Puneet Uttam
System.out.println("\n");
for(int i=1;i<=n;i++)
{
int k=0,c1=1,c2=1,c3=1,c4=1,c5=1,c6=1,c7=1,c8=1;
while(k<str.length())
{
if(k<str.length()&&ar[k]=='A')
{
for(int j=1;j<=n;j++)
{
if(j==n &&i==1)
continue;
if((j==1 && i>1)||(i==1 &&
j>1)||i==a||j==n)
System.out.print("A ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
//Created By Puneet Utam
if(k<str.length()&&ar[k]=='B')
{
for(int j=1;j<=n;j++)
{
if(j==1|| (i==1 && j!=n)||(i==n &&
j!=n)||(i>1 &&i<n &&j==n)||i==a)
System.out.print("B ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='C')
{
for(int j=1;j<=n;j++)
{
if((i==1&&j!=1)||i==n&&j!=1||i>1&&i<n&&j==1)
System.out.print("C ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='D')
{
for(int j=1;j<=n;j++)
{
if(j==1|| (i==1 && j!=n)||(i==n &&
j!=n)||(i>1 &&i<n &&j==n))
System.out.print("D ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='E')
{
for(int j=1;j<=n;j++)
{
if(j==1||i==1||i==(n/2)+1||i==n)
System.out.print("E ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='F')
{
for(int j=1;j<=n;j++)
{
if(j==1||i==1||i==(n/2)+1)
System.out.print("F ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='G')
{
for(int j=1;j<=n;j++)
{
if(j==1 || i==n || i==1 || i>=a && ((j==n) ||
(i==a && j>=a)))
System.out.print("G ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='H')
{
for(int j=1;j<=n;j++)
{
if(j==1||i==(n/2)+1||j==n)
System.out.print("H ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='I')
{
for(int j=1;j<=n;j++)
{
if(i==1||i==n||j==(n/2)+1)
System.out.print("I ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='J')
{
for(int j=1;j<=n;j++)
{
if((j==n && i!=n)||(i==n &&(j!=1 &&
j!=n))||(j==1&&i>=a)&&i<n)
System.out.print("J ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
//Created By Puneet Uttam
if(k<str.length()&&ar[k]=='K')
{
for(int j=1;j<=n;j++)
{
if(j==1||(i==t && j==s1)||(i==t2 &&
j==s2)||(j==2&&i==a))
System.out.print("K ");
else
System.out.print("
");
}
if(c7==Kfreq)
{
s1=s1-2;t++;
if(i>=a+1)
{
s2=s2+2;t2++;
}
}
if(c7<Kfreq)
{
c7++;
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='L')
{
for(int j=1;j<=n;j++)
{
if(j==1||i==n)
System.out.print("L ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='M')
{
for(int j=1;j<=n;j++)
{
if(j==1||j==n ||((i<=a) && ((i==j)||(j==n-EE))))
System.out.print("M ");
else
System.out.print("
");
}
if(c5==Mfreq)
{
EE++;
}
if(c5<Mfreq)
{
c5++;
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='N')
//Created By Puneet Uttam
{
for(int j=1;j<=n;j++)
{
if(j==1||j==n||j==i)
System.out.print("N ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='O')
{
for(int j=1;j<=n;j++)
{
if(((i==1 ||i==n)&&(j>1&&j<n))||((j==1
||j==n)&&(i>1&&i<n)))
{
System.out.print("O ");
}
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='P')
{
for(int j=1;j<=n;j++)
{
if(j==n &&i==1)
continue;
if((i==1&&j!=n)||i==a||(j==n &&
i<a)||j==1)
System.out.print("P ");
else
System.out.print("
");
}
k++;
System.out.print("\t");
}
if(k<str.length()&&ar[k]=='Q')
{
for(int j=1;j<=n;j++)
{
if(((j==1||j==n||i==1||i==n)) ||(i>=a && j==m))
System.out.print("Q ");
else
System.out.print("
");
}
if(c4==Qfreq)
{
m++;
}
if(c4<Qfreq)
{
c4++;
}
if(i==n)
System.out.print("Q Q
");
else
System.out.print("\t");
k++;
}
if(k<str.length()&&ar[k]=='R')
{
for(int j=1;j<=n;j++)
{
if((j==1||i==1||i==a)||(i>a && j==k2)||(j==n
&& i<=a))
System.out.print("R ");
else
System.out.print("
");
}
System.out.print("\t");k++;
if(c1==Rfreq)
{
k2++;
}
if(c1<Rfreq)
{
c1++;
}
}
if(k<str.length()&&ar[k]=='S')
{
for(int j=1;j<=n;j++)
{
if((i==1&&j!=1)||i<a&&(j==1&&i!=1)||i==a&&j!=n||i==n&&j!=n||i>=a&&(j==n&&i!=n))
System.out.print("S ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='T')
{
for(int j=1;j<=n;j++)
{
if(i==1||j==(n/2)+1)
System.out.print("T ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='U')
{
for(int j=1;j<=n;j++)
{
if(j==n &&i==n)
continue;
if(j==1 && i!=n||(j==n&&i!=n)||(i==n
&&j>1))
System.out.print("U ");
else
System.out.print("
");
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='V')
{
for(int j=1;j<=n;j++)
{
if((i<=a && (j==1||j==n)) || i>=a &&
j==s+2 || j==l )
System.out.print("V ");
else
System.out.print("
");
}
if(c3==Vfreq)
{
s++;l--;
}
if(c3<Vfreq)
{
c3++;
}
System.out.print("\t");k++;
//Created By Puneet Uttam
}
if(k<str.length()&&ar[k]=='W')
{
for(int j=1;j<=n;j++)
{
if(j==1||j==n ||((i==j || j==n-WW) && i>=a))
System.out.print("W ");
else
System.out.print("
");
}
if(c6==Wfreq)
{
WW++;
}
if(c6<Wfreq)
{
c6++;
}
System.out.print("\t");k++;
//Created By Puneet Uttam
}
if(k<str.length()&&ar[k]=='X')
{
for(int j=1;j<=n;j++)
{
if(i==j||j==n-k4)
System.out.print("X ");
else
System.out.print("
");
}
if(c2==Xfreq)
{
k4++;
}
if(c2<Xfreq)
{
c2++;
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]=='Y')
{
for(int j=1;j<=n;j++)
{
if((i==j && i<=a)|| (j==a)&& i>=a ||
(j==k5 && j<=k5 && i<a))
System.out.print("Y ");
else
System.out.print(" ");
}
System.out.print("\t\t");
if(c8==Yfreq)
{
k5--;
}
if(c8<Yfreq)
{
c8++;
}
k++;
}
if(k<str.length()&&ar[k]=='Z')
{
for(int j=n;j>0;j--)
{
if(i==1||i==n||j==i)
System.out.print("Z ");
else
System.out.print("
");a
}
System.out.print("\t");k++;
}
if(k<str.length()&&ar[k]==' ')
{
for(int j=1;j<=n;j++)
{
System.out.print("
");
}
k++;
}
}
System.out.println();
}
System.out.println();
System.out.println("\n");
System.out.println("\n\n\t\t\tIF YOU WANT TO USE IT
AGAIN PRESS ANY NUMBER ELSE 0");
System.out.print("\n\t\t\t ENTER A NUMBER :");;
time=Integer.parseInt(br.readLine());
System.out.println();
}
while(time>0);
System.out.println("\n\n\t\t\t$$$$$ = THANK YOU FOR
USING THIS PATTERN PROGRAM = $$$$$");
System.out.println("\n\t\t\t$$$$$ = AND HOPE THAT YOU
HAVE LIKE THIS PROGRAM = $$$$$");
}
OUTPUT
If you have any question then leave a comment below I will do my best to answer that question, please give me your review about this program and guys don't forgot to subscribe.
very knowledgeful
ReplyDeleteNice program
ReplyDeletegreat program
ReplyDeleteThanks for your kind words!
DeleteGreat !!!
ReplyDeleteThanks a lot!
DeleteSuperb!! Well done
ReplyDeleteThanks brother.😊😊😊
Delete