Starting from:

$30

CS2028-Homework 1 Working with Files and Structures Solved

The objective of this homework is to create structures, read from, create and write to files using C++..  This assignment will incorporate arrays 

 

Scenario:

You are a programmer tasked to take the plain text from a series of formatted files and create a library card catalog file and a statistics file.  

 

Requirements:

1.     Ask the user for the name of the file to be processed.

2.     Attempt to open the file of the given name.  If unsuccessful, it should output an error message and prompt the user to enter another file name.

3.     With the file open, read into a Structure:

a.      Title

b.     Author full name (the name is stored in the file as First and Last name with a space between)

c.      Word Count (total number of words in the book contents.  A word is one or more letters

(not counting punctuation) separated by a space so ice cream is considered 2 words)

d.     Letter frequency (this is the number of times each letter has been encountered in the book contents)

e.      Line Count (count of new line characters in the contents section)

4.     Save this information in the file CardCatalog.txt

a.      If the file doesn’t exist, create it.

b.     If the file does exist, append to it.

c.      Leave a blank line between each card catalog entry.

d.     The file should be human readable such as (is should be similar but not necessarily the same as the following*):

Title: Moby Dick

Full Author: Herman Melville

Author First Name: Herman

Author Last Name: Melville

Word count: 375

Line count: 17

5.     Ask the user if they want to see the letter frequency.  If they agree, it should look like*: Moby Dick letter frequency:

a: 0.0762% b: 0.0 % c: 0.0253% d: 0.0405%

6.     Ask the user if they wish to process another book.  If they do, repeat requirement 2.  If

they don’t, program should quit.  This should not add to previous results.

(*) The numbers shown heer are not necessary correct 

More products