assignment problem help needed
Hi all i am currently doing an assignment and struggling like mad all i need to do is create a right angled triangle out of asterisks such as
it has the size set to 5 and the orientation set to up all i need to know is how to get the public instance method called generate row to work correctly any help would be appreciated i am drowning i cannot get to grips with this at all.
the code for the method is below it should use a loop and concatenation to produce the triangle any help on this would be grateful.
* Class Triangle - instances model triangles as rows of asterisks
* M255 Course Team
* Version 1.0
public class Triangle
/* instance variables */
int size; // the size of the triangle; an integer between 2 and 10 inclusive
String orientation; // either "up" or "down"
* Constructor for objects of class Triangle.
this.size = 5;
this.orientation = "up";
/* instance methods */
* Return the orientation of the triangle.
public String getOrientation()
* Return the size of the triangle.
public int getSize()
* Generates a row of Asterisks
public String generateRow()
asterisk = "";
aSize = Integer.parseInt(return this.size);
for (int num = 1; num <= asize; num++)
asterisk = asterisk + "*";