Supplied file(s) $sup02/demo_display_ascii2 (the demo executable)
$sup02/display_ascii2.txt (the "TextItems" file containing program information)
Files to submit display_ascii2_main.cpp (the source code for your main driver)
display_ascii2_functions.cpp (the source code for your auxiliary functions)
display_ascii2 (your executable)
my_tests.sh (your testing script)
Where to put them Copy them to your u##/submissions/s02 subdirectory.
When they're due Sunday, February 2, 2025 @11:59pm

Overview

This second submission is Part 2 of our three-part exercise, and in addition to enhancing the previous submission with an additional alternate way of displaying the ASCII output, you must now create some functions to perform the various necessary tasks and place those functions in a separate file that will be separately compiled and linked with the compiled main driver to form the complete final executable.

We will discuss in our sessions any additional material you will need or might find helpful to know for this submission.

This second version of the program again displays ranges of ASCII characters requested by the user, along with their corresponding decimal, octal, and hexadecimal numerical ASCII codes, this time in two different formats (one format is the same as last week's). You will again make use of the DisplayOpeningScreen() and Pause() "free functions" from the instructor-supplied utilities module, as well as the TextItems class, all for the same purposes as before.

You are not provided with a "shell" program this time around, so you should refer to the shell from the previous program and use the same overall structure, including the comments at the beginning, the self-assessment comment, and the position of your include files. The major addition this time to your main driver file (display_ascii2_main.cpp) will be the prototypes of the functions whose full definitions will go into your display_ascii2_functions.cpp file.

Steps to Perform

  1. First, download a copy of the sample executable, demo_display_ascii2, as well as a copy of its companion program information TextItems file, display_ascii2.txt.
  2. Run the program without any command-line parameters and study the output. You get the same kind of opening screen as before containing the current ID information for this submission, followed this time by two screens of program description. Your program must display the same three screens (with pauses) when run without any command-line parameters, except that the first screen will contain your identification information and the timestamp showing when you created the executable.
  3. After you have studied the program description, run the program enough times with a wide variety of inputs to get a good feel for just how the program displays its output. Make sure that you display each table of values in whatever you are using for your "input test suite" using both of the two possible output formats. Note carefully where the pauses appear, the vertical and horizontal spacing, the fact that if there are fewer than four values only the required number of columns are labeled, and the fact that the screen is cleared before the display of the table of values. These are the same features seen in the previous version of the program. Do not proceed until you are completely comfortable with the program behavior.
  4. Design first, then (and only then) write a C++ program that will emulate as closely as possible the behavior of the sample executable, and keep the program in the two separate files as required.
  5. When the program is working correctly, make a final check before submission to ensure your source code is identified, formatted, and documented properly, and don't forget to include your self-assessment comment.
  6. Finally, submit the required files by copying them from your working directory to the appropriate subdirectory in your uxx account. Do not use the submission directory as a working directory.

Additional Notes, Requirements, Specifications and/or Hints (if any)

  1. The program is required to do some error checking, as described in the program description provided by the program itself, including one more error-check than the previous program. Be sure that your program recognizes and correctly deals with each of the potential errors mentioned in that description. And when running the demo, be sure to enter input that produces each of those errors and note how the demo responds. Your program must behave in the same way.
  2. A major question you have to answer is this: What are the major tasks that the program must perform? Or, put another way, what functions should go into your display_ascii2_functions.cpp file? The display of the opening screen and the two information screens are possible candidates, but both of those are handled by a very short if-statement so that code might as well remain in display_ascii2_main.cpp. That leaves three obvious choices: one function to handle the error-checking, a second to handle the "horizontal" ASCII display, and a third to deal with the "vertical" ASCII display.
  3. Your testing script this week (my_tests.sh) should follow the same pattern as last week, but of course it is important to note that this time around each range of characters and their corresponding codes can be displayed in two quite different ways (increasing horizontally, or increasing vertically), so your testing script must take account of this.
  4. When writing a function to check for errors in the command-line inputs, you can have the same parameter list for that function that your main() function has, which will give your error-checking function access to all of the command-line inputs.