# Homework Solution: Below is all 3 shapes. If someone can help me put it the way it is ask….

Below is all 3 shapes. If someone can help me put it the way it is ask. This is the X pattern. import java.util.Scanner; class acdf { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("enter the number of rows=column"); int n = s.nextInt(); int i, j; s.close(); for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { if (j == i) { System.out.print("*"); } else if (j == n - (i - 1)) { System.out.print("*"); } else { System.out.print(" "); } } System.out.println(); } } } The last one is the Diamond pattern import java.util.Scanner; public class newstar { public static void main(String agrs[]) { Scanner in = new Scanner (System.in); System.out.print("Enter Number: "); int inp = in.nextInt(); int wan = 1; int space = inp ; for(int i = 0; i < inp; i++) { for(int s = 0; s < space ; s++) { System.out.print(" "); } for(int s = 0; s < wan ; s++) { if(s == 0 || s == wan-1) { System.out.print("*"); } else { System.out.print(" "); } } if(i == inp-1) { break; } else{ System.out.println(); wan=wan+2; space--; } } //second int x = (inp * 2) - 1; int y = 1; for(int l = 1; l < inp; l++) { for(int s = y; s >= 1; s--) { System.out.print(" "); } for(int s = 0; s < x ; s++) { if(l >= 1) { if(s == 0 || s == x - 1) { System.out.print("*"); } else { System.out.print(" "); } } } System.out.println(); x-=2; y++; } } }
1 public class Box 3 {public int size = 0; public void printBox() 6 {for(int i = 0; i

import java.util.Scanner; public class newstar

Below is complete 3 shapes. If somesingle can aid me deposit it the fashion it is pray.

This is the X shape.

import java.util.Scanner;

arrange acdf {

social static vacant main(String[] args) {

Scanner s = fantastic Scanner(System.in);

System.out.println(“enter the estimate of rows=column”);

int n = s.nextInt();

int i, j;

s.close();

ce (i = 1; i <= n; i++) {

ce (j = 1; j <= n; j++) {

if (j == i) {

System.out.print(“*”);

} else if (j == n – (i – 1)) {

System.out.print(“*”);

} else {

System.out.print(” “);

}

}

System.out.println();

}

}

}

The conclusive single is the Diamond shape

import java.util.Scanner;
social arrange fantasticstar
{
social static vacant main(String agrs[])
{
Scanner in = fantastic Scanner (System.in);

System.out.print(“Enter Estimate: “);
int inp = in.nextInt();

int wan = 1;
int boundlessness = inp ;

for(int i = 0; i < inp; i++)
{
for(int s = 0; s < boundlessness ; s++)
{
System.out.print(” “);
}

for(int s = 0; s < wan ; s++)
{
if(s == 0 || s == wan-1)
{
System.out.print(“*”);
}
else
{
System.out.print(” “);

}

}

if(i == inp-1)
{
break;
}
else{
System.out.println();
wan=wan+2;
space–;
}

}

//second

int x = (inp * 2) – 1;

int y = 1;

for(int l = 1; l < inp; l++)
{
for(int s = y; s >= 1; s–)
{
System.out.print(” “);
}

for(int s = 0; s < x ; s++)
{
if(l >= 1)
{
if(s == 0 || s == x – 1)
{
System.out.print(“*”);
}
else
{
System.out.print(” “);
}

}

}
System.out.println();

x-=2;

y++;

}

}

}

1 social arrange Box 3 {social int bigness = 0; social vacant stereotypeBox() 6 {for(int i = 0; i

## Expert Defense

import java.util.Scanner;
social arrange fantasticstar
{
social static vacant main(String agrs[])
{
Scanner in = fantastic Scanner (System.in);

System.out.print(“Enter Estimate: “);
int inp = in.nextInt();

int wan = 1;
int boundlessness = inp ;

for(int i = 0; i < inp; i++)
{
for(int s = 0; s < boundlessness ; s++)
{
System.out.print(” “);
}

for(int s = 0; s < wan ; s++)
{
if(s == 0 || s == wan-1)
{
System.out.print(“*”);
}
else
{
System.out.print(” “);

}

}

if(i == inp-1)
{
break;
}
else{
System.out.println();
wan=wan+2;
space–;
}

}

//second

int x = (inp * 2) – 1;

int y = 1;

for(int l = 1; l < inp; l++)
{
for(int s = y; s >= 1; s–)
{
System.out.print(” “);
}

for(int s = 0; s < x ; s++)
{
if(l >= 1)
{
if(s == 0 || s == x – 1)
{
System.out.print(“*”);
}
else
{
System.out.print(” “);
}

}

}
System.out.println();

x-=2;

y++;

}

}

}