To Xain Malik C++, NO STRING CLASS, DMA! - 44829

Request Posted by
Brazilian

Brazilian

Rating : No Rating
Earned: $0
Request Detail
Price: $75
  • From: Computer Science, Programming
  • Due on: Mon 24 Feb, 2014 (02:45am)
  • Asked on: Mon 24 Feb, 2014
  • Due date has passed, but you can still Post Solution.
Description

HISTOGRAM, NO STRING CLASS!

--------------------
CS 202
Quarter Term Project
--------------------

-----------
THE PROJECT
-----------

For this project, write a file-processing program that can do everything in this
feature list.

Feature 1. Read a file (text or binary) into memory,
one byte at a time

Feature 2. Report things about the input file

Feature 3. Encrypt the input file

Feature 4. Draw a histogram for a set of bytes

Feature 5. Reverse the input file

Feature 6. Display help to the user, on demand

These features are addressed in more detail below.

The programmer is allowed to add features of her/his choosing to the list.

The programmer is not allowed to eliminate features from the list.

The programmer must use the functions discussed in Chapter 10 of the text book,
chiefly those of Tables 10-3 and 10-4.

It will also be useful to read Chapter 12 as background information to complete
this project.

You are free to discuss the project with your class mates and share design
information.

You are not allowed to share code.

The project you turn in must be your work, and only your work.

------------------
PROJECT COMPONENTS
------------------

The project shall consist of these three components:

a. code
b. design documentation
c. testing documentation

--------------------------------
REQUIRED PROGRAM DESIGN ELEMENTS
--------------------------------

The required design elements are discussed here.

In general, you are free to design the program any way you like, but the
following design elements must be adhered to.

1. The program must be command line driven

This means there shall be no menus in the program,
as it is not an interactive program.

2. The program name shall be

fileproc

and shall produce an executable named

fileproc.exe

3. The command line syntax shall be

fileproc infile outfile report
fileproc infile outfile reverse
fileproc infile infile2 outfile encrypt
fileproc infile infile2 outfile histogram
fileproc /?

All other command lines shall be rejected by the program.

4. The command line shall be case-insensitive

-------------------
COMMAND LINE SYNTAX
-------------------

These command lines are accepted:

(1) fileproc infile outfile report

(2) fileproc infile outfile reverse

(3) fileproc infile infile2 outfile encrypt

(4) fileproc infile infile2 outfile histogram

(5) fileproc /?

All other command lines shall be rejected by the program with appropriate error
messages.

--------------------

The command line,

(1) fileproc infile outfile report

addresses the REPORT FEATURE of the program.

It specifies an input file, an output file and a feature.

When invoked with this command line, the program shall write a report on the
input file to the output file.

--------------------

The command line,

(2) fileproc infile outfile reverse

addresses the REVERSE FEATURE of the program.

It specifies an input file, an output file and a feature.

When invoked with this command line, the program shall write the reverse of the
input file to the output file.

--------------------

The command line,

(3) fileproc infile infile2 outfile encrypt

addresses the ENCRYPTION FEATURE of the program.

It specifies two input files, an output file and a feature.

When invoked with this command line, the program shall write an encrypted
version of "infile" to "outfile" in the following way.

"infile2" shall consist of one or more pairs of ASCII codes, in decimal.

The ASCII pairs in "infile2" define the encryption code to be used.

For example, if "infile2" consists of the single pair

65 66

then the input file "infile" and the output file would be almost identical.

They would differ only in the places where ASCII code 65 occurs in "infile."

Whenever the ASCII code is found in "infile" it is replaced by ASCII code 66 in
"outfile."

As a second example, if "infile2" consists of the pairs

65 66
32 67
98 38

then the input file "infile" and the output file would differ only where ASCII
codes 65, 32 and 98 appear in "infile."

If ASCII codes 65, 32 and 98 never appear in "infile" then the files "infile"
and "outfile" would be identical.

If ASCII codes 65, 32 and 98 do appear in "infile", those bytes are translated
to 66, 67 and 38, respectively.

--------------------

The command line,

(4) fileproc infile infile2 outfile histogram

addresses the HISTOGRAM FEATURE of the program.

It specifies two input files, an output file and a feature.

When invoked with this command line, the program shall write a histogram of
the counts of selected ASCII code characters.

The histogram shall be written to the output file listed on the command line.

--------------------

The command line,

(5) fileproc /?

addresses the HELP FEATURE of the program.

When invoked with this command line, the program shall display a help screen
for the user.

---------------------------
DETAILS OF THE FEATURE LIST
---------------------------

1. READ A FILE (TEXT or BINARY)

The input file can be a plain ASCII (text) file or a general (binary) file.

The program shall be able to handle both types.

2. REPORT THINGS ABOUT THE INPUT FILE

Tell the user

--- how many bytes are in the input file

--- which byte (ASCII code) appears most frequently
in the input file

--- which byte (ASCII code) appears least frequently
in the input file

--- how many times an alphabetic character appears
in the input file

--- how many times a lowercase alphabetic character
appears in the input file

--- how many times an uppercase alphabetic character
appears in the input file

--- how many whitespace characters appear in the
input file

Write all of this information to an output (report summary) file.

The name of the report summary file shall come from the user.

3. ENCRYPT THE INPUT FILE

For each byte in a given set, translate the byte into a byte with a
different ASCII value.

The input file shall be unaltered and an encrypted copy of it shall be
written.

The name of the encrypted file shall come from the user.

The set of bytes to encrypt, and the new encrypted values, shall come from a
second input file.

4. DRAW A HISTOGRAM FOR A SET OF BYTES

For each byte in a given set, count the occurrences of that byte.

Draw a histogram for the whole set of bytes.

The set of bytes (that will be counted) shall be made shall come from a
second input file.

For example, if the second input file "infile2" consists of this set of
ASCII codes

65
66
67
68
69

the program shall count the number of occurrences of the letters A B C D and
E, in the input file, and, next, output a histogram that illustrates those
counts.

Scale the histogram accordingly, with a key.

For example,

+--------------------------------------------------------------+
| |
| 65 ***** |
| 66 ** |
| 67 ******* |
| 68 ** |
| 69 |
| |
| |
| |
| |
| |
| |
| Where each * means 1-100 occurrences of that ASCII code. |
| |
+--------------------------------------------------------------+

Thus, the histogram shown above means:

ASCII 65 occurs between 401 and 500 times in "infile"
ASCII 66 occurs between 101 and 200 times in "infile"
ASCII 67 occurs between 601 and 700 times in "infile"
ASCII 68 occurs between 101 and 200 times in "infile"
ASCII 69 does not occur in "infile"

5. REVERSE THE INPUT FILE

Writes a new file, equivalent in size to the input file, but with each byte
in reverse order.

As a simple example, consider the input file with these five bytes:

abcde

The reverse output file would contain the same five bytes, in reverse
order:

edcba

Note that for this example, the middle byte remains the same in both files.

----------
SUBMISSION
----------

Here is what you submit.

i. A program built from your source code file(s)
ii. Test cases you have run through your program
iii. Source code file(s) used to build your program
iv. MSVS2012 project, zipped into a ZIP archive file

-------
GRADING
-------

Each student shall make an appointment with the grader to run and explain the
program.

50% deduction in grade for:

--- Code that will not compile
--- If the code is not well documented with
appropriate comments (nonsense comments
are inappropriate)
--- Late projects (within 24 hours)

Late Projects

--- 50% deduction for the first 24 hours.
--- Not accepted 24 hours after the due time.

1 Solution for To Xain Malik C++, NO STRING CLASS, DMA!
Title Price Category solution By purchased  
File Processing System
$75.00 no category xain 1 time(s)
Please Login or Register to Submit the Solution for the Request