Write a method for Turtle to draw an equilateral triangle. Pass in the length of the sides.
What will be an ideal response?
```
public void dr awEqui l a t e r a lTr i ang l e ( int width )
{
this . turn ( 3 0 ) ;
this . forward ( width ) ;
this . turn ( 1 2 0 ) ;
this . forward ( width ) ;
this . turn ( 1 2 0 ) ;
this . forward ( width ) ;
this . turn ( 9 0 ) ;
}
```
Computer Science & Information Technology
You might also like to view...
How many times will the following code print "Welcome to Java"?
int count = 0; do { System.out.println("Welcome to Java"); count++; } while (count < 10); a. 8 b. 9 c. 10 d. 11 e. 0
Computer Science & Information Technology
Which of the following is not one of the major components of a computer system?
a. the preprocessor b. the CPU c. main memory d. input/output devices e. secondary storage
Computer Science & Information Technology