
Patrick B. answered 06/27/21
Math and computer tutor/teacher
interface IResit
{
int number=3;
char iChar = '#';
public void drawShape();
}
interface IShape extends IResit
{
public void drawShape();
}
interface IBilgi
{
public void myShape(char myChar);
public void draw
}
class Shape implements IResit,IShape,IBilgi
{
protected int N;
protected char chChar;
Shape() { N = number; chChar=iChar; }
Shape(int n)
{
N = n;
chChar = iChar;
}
Shape(char ch)
{
N = number;
myShape(ch);
}
Shape(int n, char ch)
{
N = n; myShape(ch);
}
public int GetNum() { return(N); }
public char GetChar() { return(chChar); }
public void myShape(char myChar)
{
chChar = myChar;
}
public void drawShape()
{
for (int iLoop=1; iLoop<=N; iLoop++)
{
for (int jLoop=1; jLoop<=iLoop; jLoop++)
{
System.out.print("#");
}
if (iLoop%2==1)
{
System.out.println(chChar);
}
else
{
System.out.println("");
}
}
for (int iLoop=N-1; iLoop>0; iLoop--)
{
for (int jLoop=1; jLoop<=iLoop; jLoop++)
{
System.out.print("#");
}
if (iLoop%2==1)
{
System.out.println(chChar);
}
else
{
System.out.println("");
}
}
}
}
class ShapeMain
{
public static void main(String args[])
{
Shape shape = new Shape(3,'*');
shape.drawShape();
}
}