Question: Complete the following method that prints a right triangle made out of asterisks given a height and an output file name. You can assume that

Complete the following method that prints a right triangle made out of asterisks given a height and an output file name. You can assume that height will always be positive and all necessary imports have been made. The output file is also allowed to contain an empty trailing line. Sample output: printRightTriangle(5, "output") output contains: * *** ***** ******* ********* printRightTriangle(1, "output") output contains: * public static __a__ printRightTriangle(int height, String outputFilename) throws __b__ { File outputFile = __c__; PrintWriter fileWriter = __d__; int numAsterisks = __e__; for (int currHeight = 0; __f__; currHeight++) { for (int astCount = 0; __g__; astCount++) { fileWriter.__h__; } fileWriter.__i__; __j__; } fileWriter.flush(); // PrintWriter's close() does not flush fileWriter.close(); } __a__: [ Select ] __b__: [ Select ] __c__: [ Select ] __d__: [ Select ] __e__: [ Select ] __f__: [ Select ] __g__: [ Select ] __h__: [ Select ] __i__: [ Select ] __j__: [ Select]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!