/ **
*固体ダイヤモンド
* /
パブリック静的ボイドmethod8(){
System.out.print( "输入实心菱形的行数请:");
INT、N = in.nextInt()。
INT upRows = N / 2、スターコントロール= 2、spaceControl = -1、spaceNum = N / 2、starNum = 1。
以下のために(INT i = 0; iは<、n iは++){
(= upRows I)の場合> {
スターコントロール= -2。
spaceControl = 1。
}
のための(INT J = 0であり、j <= spaceNumあり、j ++){
System.out.print(」「)。
}
spaceNum + = spaceControl。
(INT J = 0; J <starNumあり、j ++){ため
System.out.print( "*")。
}
starNum + =スターコントロール。
System.out.println();
}
}
/ **
*空心菱形
* /
パブリック静的な無効method9(){
System.out.print( "请输入空心菱形的行数:");
INT、N = in.nextInt()。
INT upRows = N / 2、spaceContentControl = 2、spaceContentNum = 1、spaceControl = -1、spaceNum = N / 2。
以下のために(INT i = 0; iは<、n iは++){
(= upRows I)の場合> {
spaceControl = 1。
spaceContentControl = -2。
}
のための(INT J = 0であり、j <= spaceNumあり、j ++){
System.out.print(」「)。
}
spaceNum + = spaceControl。
(I> 0 && iがN < - 1)の場合{
System.out.print( "*")。
{(J ++ INT J = 0; J <spaceContentNum)のために
System.out.print(」「);
}
spaceContentNum + = spaceContentControl。
System.out.print( "*");
*空心菱形
* /
パブリック静的な無効method9(){
System.out.print( "请输入空心菱形的行数:");
INT、N = in.nextInt()。
INT upRows = N / 2、spaceContentControl = 2、spaceContentNum = 1、spaceControl = -1、spaceNum = N / 2。
以下のために(INT i = 0; iは<、n iは++){
(= upRows I)の場合> {
spaceControl = 1。
spaceContentControl = -2。
}
のための(INT J = 0であり、j <= spaceNumあり、j ++){
System.out.print(」「)。
}
spaceNum + = spaceControl。
(I> 0 && iがN < - 1)の場合{
System.out.print( "*")。
{(J ++ INT J = 0; J <spaceContentNum)のために
System.out.print(」「);
}
spaceContentNum + = spaceContentControl。
System.out.print( "*");
}他{
System.out.print( "*")。
}
のSystem.out.println();
}
}
System.out.print( "*")。
}
のSystem.out.println();
}
}