Hi good evening po. Sana makatulong kayo. Bukas or sa monday na ipapasa yung project. Bali ang gagawin ay array siya at mag eenter ka ng 8 design then size. Pwede niyo pong i-edit etong code ko or gawa kayo ng new. Talagang nahihirapan kami ng kasama ko hehe salamat po. Godbless
import java.util.Scanner;
public class proj
{
public static void main(String[] args)
{
Scanner java = new Scanner(System.in);
int size,length, width, height,choice, i, j;
System.out.println("Macapinlac, Ryan Kristoffer");
System.out.println("De Guzman, Mc Einnor");
System.out.println("Midterm Project");
choice = 1;
while (choice != 8)
{
System.out.println("\nMenu of shapes: \n");
System.out.println(" 1) Square.");
System.out.println(" 2) Rectangle.");
System.out.println(" 3) Hollow Square.");
System.out.println(" 4) Diamond.");
System.out.println(" 5) X.");
System.out.println(" 6) Pinwheel");
System.out.println(" 7) ------");
System.out.println(" 8) Quit Program\n");
System.out.print("Enter the number of the shape you want: ");
choice = java.nextInt();
System.out.println();
switch (choice)
{
case 1:
System.out.print("Enter the size of the square: ");
size = java.nextInt();
System.out.println();
for (i = 1; i <= size; i++)
{
for (j = 1; j <= size; j++)
System.out.print("*");
System.out.println();
}
break;
case 2:
System.out.print("Enter the length of the rectangle: ");
length = java.nextInt();
System.out.print("Enter the width of the rectangle: ");
width = java.nextInt();
System.out.println();
for (i = 1; i <= length; i++){
for (j = 1; j <= width; j ++)
System.out.print("*");
System.out.println ();
}
break;
case 3:
System.out.print("Enter the size of the square: ");
size = java.nextInt();
System.out.println();
{
for( i=1; i<=size ;i++){
System.out.print("*");
}
System.out.println(" ");
for ( j = 1; j <= size-2 ; j++)
{
for( i=1; i<=size ;i++)
{
if ( i == 1 || i == size)
{
System.out.print("*");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
for(i=1; i<=size ;i++){
System.out.print("*");
}
} break;
case 4:
System.out.print("Enter the size of the diamond: ");
size = java.nextInt();
for( i=1;i<=size;i++)
{
for( j=size;j>=i;j--)
{
System.out.print(" ");
}
for(int m=1;m<=i;m++)
{
System.out.print(" *");
}
System.out.println();
}
for( i=1;i<=size;i++)
{
for( j=1;j<=i;j++)
{
System.out.print(" ");
}
for(int m=size;m>=i;m--)
{
System.out.print(" *");
}
System.out.println();
}
break;
case 5:
System.out.print("Enter the size(MUST BE ODD NUMBER): ");
size = java.nextInt();
int x = 0;
int y = size-1;
for (i = 0; i < size; i++)
{
for (j = 0; j < size; j++)
{
if (x == y && j == i)
System.out.print('*');
else if (x == j || y == j)
System.out.print('*');
else
System.out.print(' ');
}
x++;
y--;
System.out.println();
} break;
case 6:
int r,c;
char ch='*';
int base=5;
int ht=5;
int len = (base * 2);
int star = 1;
for(r=0;r<ht;r++) {
for(c=0;c<len;c++) {
if(c<star)
ch='*';
else if(c>=star && c<len-base)
ch=' ';
else if(c>=star && c<len-r)
ch='*';
System.out.print(ch);
ch=' ';
}
System.out.println();
++star;
}
star=base-1;
for(r=0;r<ht;r++) {
for(c=0;c<len;c++) {
if(c<star)
ch=' ';
else if(c>=star && c<len-base)
ch='*';
//else if(c>=star && c<len-r)
//ch=;
System.out.print(ch);
ch=' ';
}
System.out.println();
--star;
}
break;
}
}
}
}
via Symbianize Forum http://www.symbianize.com/showthread.php?t=1077540&goto=newpost