Question: Create an ASCII drawing tool. 1 . Please see the examples in this document to see how tool runs and how it reacts to valid

Create an ASCII drawing tool. 1. Please see the examples in this document to see how tool runs and how it reacts to valid and invalid input.2. This assignment includes using two provided files DrawTool.h and DrawTool.c. You are required to use these files and you are not allowed to alter them. You must write your code to use these library files. You will not be submitting these two files as part of your assignment, so if you alter them to make your code work, then your code will fail when the GTA compiles with the original versions. 3. Use the following pseudocode to get you started on the program. Include DrawTool.h in your Code4.c file. In main() Declare a 2D array with a max size of 20 for both dimensions. Anything larger than 20 tends to wrap and be messy on the screen. This max size is set as a #define in DrawTool.h. You should not hardcode 20 anywhere in your program use the #define from DrawTool.h. Call function InitializeMap from DrawTool Parameters array user-chosen size of the map (pass by reference). Call function PrintInstructions() from DrawTool No parameters Call function to PrintMap() from DrawTool Parameters array user-input size of the map Prompt for a draw command and read it using fgets(). Then use strtok() to parse out just the draw command (Q, P, V or H). If the user entered 'Q' or 'q' as the draw command, then your program should quit. If the user did not enter Q, then use strtok() to parse out the rest of the components of the draw command. If the mark value is not entered, then X should be used as a default value. The draw command should be entered as described in the instructions. Each draw command is one prompt not multiple prompts. All draw commands should be validated to ensure they will not go out of bounds. Check for out of bounds for both the coordinate and line. You cannot draw a line that will end of out of bounds. For the point command ('P'), update that point in the array with the input mark. For the horizontal ('H') and vertical ('V') commands, call function DrawLine() from DrawTool. Drawing a line means marking those spots with the input mark in the array. This function should be passed the array, the row,col from the command, the action (H or V), the number of spots to mark and the mark itself. The function will use for loops to appropriately move through the array and mark the spots. Any draw command that do not start with Q, P, V or H will generate an output of "That draw command is unknown". Draw commands of P, V and H can be entered in upper or lowercase. Use function toupper() to convert all input commands to uppercase. The program will continue to prompt for draw commands and display the array until the user quits. 4. Create the makefile to compile Code4.c and DrawTool.c. You are required to use the makefile template provided with this assignment. Be sure to include your name in the first line comment (comments in makefiles start with #)5. Files to submit in a zip file named Code4_xxxxxxxxxx.zip1. Code4_xxxxxxxxxx.c 2. Submit a file that you created named "input.txt" that contains the draw commands to output your initials. Be sure to state in your assignment submission what those initials are. Your input file needs to contain ALL of the commands to complete a full run. See video attached to assignment for how to use this file and how your program should behave. Test this process using the UNIX redirect command as shown in the video. 3. makefile ATTENTION : Do not alter the DrawTool.c or DrawTool.h files. You are not submitting those; therefore, any changes you make to them to make your code work will not be present when your code is graded. Miscellaneous Notes 1. Array is statically allocated using a define set to the maximum value (20). The user will be prompted for what size array they want to display within that 20x20 array. When passing the array, you must use the max size, not the user input size in function calls/definitions.2. The GTA will be running your program with your file and a file of draw commands that are both valid and invalid to test the functionality of your program. Be sure to test for and reject commands that go out of the bounds of the array. Be sure to test that you can draw along the edges of your array. 3. Using the following command ./Code4_xxxxxxxxxx.e < input.txt is using the UNIX redirect command. The < symbol takes the contents of input.txt and dumps it completely into stdin. Your program then reads from stdin for each prompt rather than asking you. During this process, the actual commands do not show on the screen since they are not being typed. It will be very important to this process that your file have UNIX end of lines rather than Mac. If you are on a Mac, you will need to run your input file through this UNIX command to transform the Mac CR EOLs to UNIX LF EOLs. cat file.txt | tr '\r''
'| tr -s '
'> newfile.txt file.txt is the original file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!