Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to create two classes LeftArrow and RightArrow class that are child class

ID: 3537877 • Letter: I

Question

I need to create two classes LeftArrow and RightArrow class that are child classes of the ShapeBase class in java.


Each of these two classes need to draw a left and right arrow using asterisks.

I can't display the code without it messing up the page.

All I need is to figure out the logic to display the arrow left or right.


************************************************************************


public abstract class ShapeBase implements ShapeInterface

{

private int offset;


public ShapeBase( )

{

offset = 0;

}


public ShapeBase(int theOffset)

{

offset = theOffset;

}


/**

Draws the shape at the current line.

*/

public abstract void drawHere( );


/**

Draws the shape at lineNumber lines down

from the current line.

*/

public void drawAt(int lineNumber)

{

for (int count = 0; count < lineNumber; count++)

System.out.println( );

drawHere( );

}


public void setOffset(int newOffset)

{

offset = newOffset;

}


public int getOffset( )

{

return offset;

}

}

Explanation / Answer

public abstract class ShapeBase implements ShapeInterface
{
private int offset;
public abstract void drawHere();
.
.
.
public void draw At(int lineNumbers)
{
for(int count = 0; count < lineNumber; count++)
System.out.println();
drawHere();
}
}

public interface ShapeInterface
{
//Sets the offset for the shape
public void setOffset(int new Offset);

//Returns the offset for the shape
public int getOffset();

//Draws the shape at lineNumber lines
down from current line position
public void drawAt(int lineNumber);

//Draws the shape at the current line
public void drawHere();

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote