|
|
|
On this lab (and all future work in this course), the name of the files you submit and the name of the classes they contain must match. That is, the file Foo.java must contain (only) the class Foo .
-
Create a class
Triangle that contains the following functions:
-
The function
triangleLoop should take a string as its argument and print the characters of the string as a “triangle”, adding one character with each line. So, the statement Triangle.triangleLoop("CMPT"); should print this:
C
CM
CMP
CMPT
This much be done with a loop.
-
The function
triangleRecursive should do the same as triangleLoop , but must be written recursively. It should not contain a loop.
-
The function
triangleUpLoop should be similar to triangleLoop , but should print a triangle that grows up, instead of down. So, Triangle.triangleUpLoop("CMPT"); should print this:
CMPT
CMP
CM
C
This much be done with a loop.
-
The function
triangleUpRecursive should do the same as triangleUpLoop , but must be written recursively. It should not contain a loop.
-
Create a text file named
time.txt . In it, indicate how long it took you to complete this lab exercise.
When you're done, create a ZIP file containing all of the files you created for this lab and submit it with the submission server.
|
|