import java.util.Scanner;
public class Draw {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int width = 0;
int height = 0;
int select;
System.out.print("Enter Width :");
width = input.nextInt();
System.out.print("Enter Height :");
height = input.nextInt();
System.out.println("=============================================");
System.out.println("| SELECTION |");
System.out.println("|===========================================|");
System.out.println("| Option : |");
System.out.println("| 0: Exit |");
System.out.println("| 1: Empty Shape |");
System.out.println("| 2: Filled Shape |");
System.out.println("=============================================");
select = input.nextInt();
switch (select)
{
case 0 :
System.out.println(" ...EXIT...");
System.exit(0);
break;
case 1:
System.out.println("Filled Shape ");
for(int i=1;i<=height;i++)
{
for(int j=1;j<=width;j++)
{
if((i==1 || i==height) || (j==1 || j==width))
{
System.out.print("*");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
break;
case 2:
System.out.println("Filled Shape ");
for(int i=1;i<=height;i++)
{
for(int j=1;j<=width;j++)
{
if((i==1 || i==height) || (j==1 || j==width))
{
System.out.print("*");
}
else
{
System.out.print("*");
}
}
System.out.println();
}
break;
}
System.out.println("Width :"+width+" Height :"+height);
}
}
saadismail85 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.