Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Coding CSE 1320 1. The format and content of the output is not a suggestion it is the specification given to you to follow so

Coding

CSE 1320

1. The format and content of the output is not a suggestion it is the specification given to you to follow so please follow it exactly. Points will be lost for not following the specification.

2. Please note that part of your grade is how you coded the program in addition to outputting valid responses.

3. Make sure your name and student id are in a comment in the first line of your program.

4. Compile your code on Omega to ensure it is error and warning free and works as expected BEFORE submitting.

5. Check the rubric BEFORE submitting to ensure that you have fulfilled all requirements.

6. This program will contain NO global variables using any will result in the loss of points.

Create an ASCII drawing tool.

1. Please watch the video attached to the assignment to see how tool runs and how it reacts to invalid input.

2. Use the following pseudocode to get you started on the program.

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 should be set as a #define.

Prompt the user for how big of an array they want to use. Use a while loop to verify that the entered size fits within the bounds of the max array size. If a value too big or small is entered, then ask again.

Prompt the user for a background character.

Initialize the array with the background character using the user input size (NOT the max size).

Print the instructions for using the tool. I have provided them here so you can copy them into your program. You will need to provide the proper line breaks and tabs to get the same format. All of the instructions should fit on one screen.

Draw commands start with

P for a single point

H for a horizontal line

V for a vertical line

After the P/V/H, enter a row,col coordinate and the number of spots to mark

enclosed in () and separated by commas and then the character for the mark.

'X' will be used if a mark is not entered. For example,

P(2,3,1)* start at point 2,3 in the array and mark one spot

with an *. For P, the 3rd parameter is ignored.

V(1,2,3)$ start at point 1,2 in the array and mark the next

3 spots to the right with $

H(4,6,7)# start at point 4,6 in the array and mark the next

7 spots down from the current position with #

Coordinates out of range and lines drawn past the borders are not allowed.

Enter Q at the draw command prompt to quit

Press to continue

The program should pause until the user presses to continue.

After the user presses any key to continue, call a function to print the array to screen. The array should be passed to the function and the function should use nested for loops to print it to the screen. The size of the array (the user entered size not the max size) will need to be passed to the function also.

Prompt the user to enter a draw command. If the user enters 'Q' or 'q' as the draw command, then your program should quit.

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 a function to "draw" that line. 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.

The program will continue to prompt for draw commands and display the array until the user quits.

Files to Submit

1. Submit Code3_xxxxxxxxxx.c

2. Submit a file named "input.txt" that contains the draw commands to output your initials. Be sure to state in your assignment submission what those initials are (you can add this information in Blackboard with the "Text Submission" button). Be sure your input file contains ALL of the commands to complete a full run. See video for how to use this file and how your program should behave.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions