Program
About
When a flowchart is converted to a target programming language, the
system starts in the [Program] section. This
section allows the developer to insert the Main Function,
additional functions,
function headers, and other needed definitions. As a result, this
section makes heavy use of flags.
Java Example |
[Program] |
Text |
= import java.util.*; |
|
|
|
= import java.lang.Math; |
|
|
|
= |
|
|
|
= public class JavaApplication {{ |
|
|
|
= private static Scanner input = new Scanner(System.in); |
| input |
| 1 |
|
= private static Random random = new Random(); |
| random |
| 1 |
|
= |
|
|
|
= -->MAIN |
| |
| 1 |
|
= -->FUNCTIONS |
| |
| 1 |
|
= |
| tofixed |
| 1 |
|
= private static String toFixed(double value, int digits) {{ |
| tofixed |
| 1 |
|
= return String.format("%." + digits + "f", value); |
| tofixed |
| 2 |
|
= } |
| tofixed |
| 1 |
|
= } |
|
|
In the example above, flags are used to, optionally, create declarations
for Scanner and Random if the program uses the Input
Statement and the Random Function respectively. In addition, if the
ToFixed Function is used, the template will create a local function called
toFixed() that will implement that logic.
Text Key
The text key is used to generate the syntax of the main program. It
doesn't contain any fields.
To insert the While Statement's block, use
a single line containing the following special codes. If you want to
change the indentation of the block, make sure to specify the indent after
the second pipe |.
Special value |
What it does |
-->HEADERS |
Inserts function headers. These will be
generated using the [Function Header]
section. |
-->MAIN |
Inserts the main function. This is defined
in [Main Function]. |
-->FUNCTIONS |
Inserts the programs functions. This does
not include Main. These are
defined in [Function]. |
|