Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your assignment is to develop a system to import ASCII art from a file or to create ASCII art manually. Each file will have a

Your assignment is to develop a system to import ASCII art from a file or to create ASCII art manually. Each file will have a variable number of inputs (in no order). Each line in a file will have two integers (the x and y coordinates) and a character to display in the position.

Each image will be displayed in a 75 x 75 square.

The input files will look like this:

image text in transcribed

Figure 2. Sample Input File (Fish)

You will have to load in the file into a two-dimensional array and then display it. This example is a simple fish. Because we are using a 75x75 grid (they should be constants), there will be a lot of empty spaces around our fish (which is fine).

0

1

2

3

0

_

1

>

_

>

Figure 3. Output of Sample Input File (Fish)

  1. Requirements:

This is a list of the requirements of this application. For this project, it is up to you exactly how you want to implement it. For you to earn all the points, however, you will need to meet all the defined requirements.

  • You must follow the coding standard as defined in the CMSC 202 coding standards (found on Blackboard under course materials). This includes comments as required.
  • The project must be turned in on time by the deadline listed above.
  • The project must be completed in C++. You may not use any libraries or data structures that we have not learned in class. These are the only libraries that you are allowed to use in this project - , , , , and . YYou may NOT use . You should only use namespace std.
  • You must use a variety of functions (at least 5) including passing parameters to those functions and returning information from those functions. At least one time, an array must be passed to a function (although you may do this more than once).
  • The menu must be implemented with a switch statement.
  • All user input must be validated. For example, if a menu allows for 1, 2, or 3 to be entered and the user enters a 4, it will re-prompt the user. However, the user is expected to always enter the correct data type. i.e. If the user is asked to enter an integer, they will. If they are asked to enter a character, they will. You do not need to worry about checking for correct data types.
  • The name of the input file is variable. As a hint, dont forget that the open command must use a c-string. You are not allowed to use in this project.
  • You must use at least one multi-dimensional array in this project.
  • Have a main menu that asks if the user wants to:
    • Load a file of ASCII art data (4 test files have been provided including proj1_pic1.txt, proj1_pic2.txt, proj1_pic3.txt, and proj1_pic4.txt.
    • Create ASCII Art manually where the user enters an X and Y coordinate and then a character for that location. They should be able to manually edit a previously loaded file (although it will not permanently change in the input file).
    • Display the art.
    • Rotate the art 90 degrees to the clockwise. Some images will not make sense rotated (proj1_pic1.txt is a bad example). However, if you rotate any of the pictures 4 times, they should be identical to the way they started.
    • Invert the art both vertically or horizontally.
      • Vertical should display like the image was rotated twice. For example, the fish from proj1_pic1.txt should go from the upper left corner to the bottom right corner.
      • Horizontal should display the image backwards. For example, the fish from proj1_pic1.txt should go from the upper left corner to the upper right corner and backwards (it will look strange).
    • Exit and include a thank you message for the user
  • Specific coding requirements include:
    • Must use at least 5 different functions.
    • Must use at least two different arrays.
    • Must pass an array to a function.
    • Must read in a file into a two-dimensional array.
    • Must use at least one switch statement.
    • Must use input validation (assume the data is the correct type).
    • Must use at least one do..while loop.
    • Must use constants as needed.
  1. Recommendations

You are free to implement this with your own functions. While not required, these are some functions that you may want to include:

    • Main Menu Welcomes the user to the application and has the user choose between loading a data file, creating the art manually, displaying the art, rotating the art, inverting the art (vertical or horizontal), or exiting.
    • Load ASCII Art from File Prompts the user for the name of the input files then displays the data loaded.
    • Create ASCII Art Manually Allows the user to enter x and y coordinate and a character to update the current art (could be new or loaded from a file)
    • Rotate Art Rotates the art 90 degrees clockwise
    • Invert Art Calls invertHorizontal or invertVertical which do as described above.
  1. Sample Input and Output

For this project, input files are very simple. The first data file is called proj1_pic1.txt and just includes 5 coordinates for a fish.

0 2 _

1 3 >

1 1

1 0 >

1 2 _

There are additional input files for you to test. The proj1_pic4.txt looks pretty good when rotated or inverted although it has a lot of entries (Happy Valentines Day!).

The four data files can be downloaded from Prof. Dixons data folder by navigating to your project 1 folder and typing the following command:

cp /afs/umbc.edu/users/j/d/jdixon/pub/cs202/proj1/proj1_*.txt .

After you copy the art files, you can type cat proj1_pic1.txt or cat proj1_pic2.txt etc. and it should show you the entire file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions