Supplied file(s) demo_display_ascii3 (the demo executable)
display_ascii3.txt (the "TextItems" file containing program information)
Files to submit display_ascii3_main.cpp (the source code for your main driver)
display_ascii3_functions.cpp (the source code for your two auxiliary functions)
display_ascii3 (your executable)
AsciiGenerator.h (your class specification file)
AsciiGenerator.cpp (your class implementation file)
No my_tests.sh required this time ... see below.
Where to put them Copy them to your u##/submissions/s03 subdirectory.
When they're due Sunday, February 9, 2025 @11:59pm

Overview

This third submission is Part 3 (and the last part) of our three-part exercise for generating and displaying ASCII code ranges.. This time the functionality of the program will remain essentially the same as in the previous version, which means that you can reuse all of your code that displays the ASCII codes, but the interface and the overall program structure will be quite different. In the previous version we introduced a module of separately-compiled functions into the program and saw how to combine those with a main driver to produce the final executable. This time you will also have a module of separately-compiled (but different) functions.

However, instead of taking its input from the command line, this version of the program will be menu-driven, so the user will be prompted to enter the required input from the keyboard. And "behind the scenes" you will have a new C++ class called AsciiGenerator which will contain the code that produces the tables of ASCII characters and their corresponding codes, in both formats as before. In other words, most of the code in this this new class should be code that you have already written.

You must continue using the DisplayOpeningScreen() function, the Pause() function, and the TextItems class in the same way as in the previous submissions. And now, foṙ this submission, you must also use the Menu class from the instructor-supplied utilities module to provide a menu for the program and get the user's menu choice when the program runs. You will also find the ReadChar() and userSaysYes() free functions from that same utilities module quite helpful in this program.

Steps to Perform

  1. First, download a copy of the sample executable file (demo_display_ascii3), as well as the companion "TextItems" program information file (display_ascii3.txt) that goes with it.
  2. Run the program and note that first thing to appear is an opening screen analogous to the one in the previous submissions, but this time that opening screen is followed by a screen containing a menu of options,instead of immediately being followed by one or more information screens. Option 2 on that menu now allows the user to see the online program description, if desired. The second and third options provide the program's functionality, which is essentially the same as in the previous version of the program. That is, tables of printable ASCII characters and their corresponding codes may be displayed in either of the two formats, but the input that determines the output display is now entered by the user from the keyboard.
  3. Experiment with menu options 3 and 4 of the program to confirm that its functionality is the same as before. Since this version of the program is menu driven and the user enters the input from the keyboard rather than the command line, there are a few differences. In particular, we don't have to worry about some characters being improperly interpreted on the command line. For this version we also eliminate the test which ensures that the user only inputs a single character when asked for the first or second character of the range. Instead only the first character of whatever is entered at that point is used (if you use the recommended ReadChar() function from the utilities module to read the character). Experiment with the menu itself as well, by entering invalid options (for example). The behavior you see when you do this is built into the Menu class, and not something you have to implement (except for what your program does when the user fails to enter a valid menu choice after three tries).
  4. The AsciiGenerator class (in AsciiGenerator.h and AsciiGenerator.cpp) only needs a constructor that takes in as parameters the two characters that determine the ASCII range to display and records them in private instance variables of the class, and two methods to display the characters and their codes in the two formats.
  5. You also need a free function to build the program menu, and another free function to get from the user the two characters that determine the ASCII values for the display, and these are the functions to place into your display_ascii3_functions.cpp file. As in the previous submission, prototypes for these functions must be placed in the main driver file display_ascii3_main.cpp.
  6. As before, first design, then (and only then) write a C++ program that will emulate as closely as possible the behavior of the sample executable. You must continue to following the same program structure as in the two previous two submissions.
  7. When the program is working correctly, make a final check before submission to ensure your source code is identified, formatted, and documented properly. Be sure as well that you have placed a self-assessment comment in each source code file..
  8. Finally, submit the required files by copying them to the appropriate subdirectory in your uxx account.

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

  1. Because we are not using command-line input for this program, we do not need to perform the command-line error-checking we did last time. In fact, the only error-checking this program does is to ensure that the two characters that determine the range of characters to be displayed are entered in the correct order. You can make this version of the program more flexible than the previous versions by using the ReadChar() free function from the instructor-supplied utilities module. If you use that function to read the input when the user is prompted for one of the characters to determine the range of values in the displayed table, more than one character may be entered but only the first character is taken as the entry, and the remaining characters are ignored.
  2. Also, and again because we are not using command-line input, there is no my_tests.sh testing script required. Obviously this must not be taken as meaning your program does not need to be tested! Clearly you should put your program through the same tests as before, but because the program is now menu driven it is more difficult (though not impossible) to use a testing script that simply runs and performs all the necessary tests. Thus your testing this time around will require running the program and entering the input (both valid and invalid, of course) from the keyboard.
  3. To save you some "busy work", here is the exact wording for the messages you need for the function that gets the ASCII codes from the user (you still have to figure out where they go in your code, of course):
    Choose ASCII character end points for the range of values you wish to display.
    Both end point characters must lie in the range of characters from ' ' to '~'.
    Also, the start character must precede the end character in the ASCII sequence.
    
    Enter start character for the table display:
    
    Enter end character for the table display (>= previous value):
    
    Error: The starting character for the table display must not follow
    the ending character in the ASCII sequence. Try again.