Problem Statement:
Draw a triangle for a given size, using given character and pointing toward given direction.
Language:
Java
Platform:
Command Prompt
Command:
[Program] -size [Size] -char [Char] -direction [Direction]
Expected Input:
[Size]: Any positive integer. Error should be printed if non-positive integer or string is given.
[Char]: Any single char. Error should be printed if more then one char is given.
[Direction]: R/L/U/D for Right / Left / Up / Down. Error should be printed if any other input is given.
Note: The order of parameters may change.
Hint: First make programme with fix order of parameter to get a working code. Then attempt to process the command line input for parameter reordering. This approach is known as modular approach for programming.
Expected Output:
Print the triangle of given size in given direction using given character. See example for better understanding.
Example:
Interface:
$ java DrawTriangle -size 5 -char A -direction R
Output:
A
AA
AAA
AAAA
AAAAA
AAAA
AAA
AA
A