How to Make a Terminal Report Format
Not all computer programs use graphical user interfaces (GUI), the colorful set of windows, screens and buttons that computer users have become accustomed to. Because writing programs that write to traditional terminal screens rather than creating GUIs is faster to program and uses fewer system resources, some business programs still use terminal screens. But a professional presentation is always important, so designing the program to format the reports it will display is an important step in the development process.
Decide how the reports will be formatted. This includes design decisions on the inclusion of executive summaries and other items you want between the report title and the body of the text.
Code the "entry" component of your program, where users enter reports into the system to individually prompt the user for each component of the report. For example, first have the terminal prompt "Report Title:" for the user to type in the title. After this is submitted, prompt for the next component, such as "Authors:", and repeat until the user has completely entered the text of the report.
Decide the margin lengths for your report display. This will be measured in how many characters wide you want the report; it's not an inch-based measurement. Create a loop to insert a '\n' character at your chosen interval into each component after the user adds them. This character tells the terminal to start displaying the rest of the information on a new line each time it is encountered.
Assign each report component to be stored sequentially in an array object. In C, C++ and Java, these are called arrays; in Python, they are called lists. This allows you to easily store and retrieve the data that constitutes the report.
Code the "Display" component of your program to display each component in succession. The syntax for printing the report component to the terminal will be along the lines of "Print Your-Array-Name[n]" where "Print" is your chosen language's print function, "Your-Array-Name" is the name you chose for your array and [n] is the ordinal number of which report part you are displaying.
Code your program to print '\n' characters in between report components. The number of spaces you want between components decides how many '\n' characters you need to use.
Tips & Warnings
- Remember that when working with array objects, the index for the array starts at zero, not one. Thus, the index of the first item stored in an array will have an index number of zero, and the second item will have an index number of one.