I have tried adding a main method and running the file but cannot get an * as my result.
Where am i going wrong?
more information:
(i) It should instantiate a Figure object using the empty constructor and then run the object’s drawAt() method with 2 different lineNumber values, say 2 and 6.
(ii) It should instantiate two Figure objects using 2 different theOffset values, say 5 and 10, and for each object run the drawAt() method with lineNumber equal to 4, say.
package sdexam;
public class Figure
{
private int offset;
public Figure()
{
offset = 0;
}
public Figure(int theOffset)
{
offset = theOffset;
}
public void setOffset(int newOffset)
{
offset = newOffset;
}
public int getOffset()
{
return offset;
}
public void drawAt(int lineNumber)
{
int count;
for (count = 0; count < lineNumber;count++)
System.out.println();
drawHere();
}
public void drawHere()
{
int count;
for (count = 0; count <offset; count++)
System.out.print(' ');
System.out.println('*');
}
}