Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This needs to be programmed in C. (Comment if you can) thank you CPSC 1110 Spring 2018, Programming Assignment 2 Text File Analysis Due 11:59
This needs to be programmed in C. (Comment if you can) thank you
CPSC 1110 Spring 2018, Programming Assignment 2 Text File Analysis Due 11:59 pm Wednesday, March 28th 1. Overview The purpose of this assignment is to give you some experience using arrays and functions in addition to loops & conditionals, as well as printf & scanf, declaring variables, and using logical expressions. 2. More Assignment Specifics This program will read in a text file (redirected to stdin) counting the number of times each letter occurs as well as the number of times each word of a particular length occurs (from 1 to 12 letters/characters) and a total count of any words 13 letters/characters or longer. This information will be displayed after showing the text the progranm read. After this the 5 most common and 5 least common letters will be displayed followed by the total number of words, the average word length (using floating-point division) and most frequent word length Letter counts should be case-insensitive. For example 'a and 'A should both be counted together in the total occurrences of the letter A A word is defined to be a sequence of printable non-whitespace characters uninterrupted by either a whitespace character or a non-printable character (ASCII control character). For example "abc123, abc-123" and all count as one word while "abc 123 and "abcin123" (where in is the newline character) count as two words. Printable ASCIl characters have a (decimal) value starting with 32 and ending with 126, within these there is only one whitespace character, "with an ASCIl value of 32 When listing the 5 most common/least common letters tied letters may be displayed in any order. If there is a tie between the 5 (last letter to be listed) and 6th (or beyond) most/least common letters, any subset of those tied letters may be displayed in any order. An example of a situation where both of these conditions occur is when A occurs 40 times, B occurs 30 times, C occurs 20 times and D, E and Feach occur 10times; in this situation ABCDE ABCDF, ABCED, ABCEF, ABCFD and ABCFE will all be correct listings If multiple word lengths tie for most common length, any one of these equally occurring word lengths may be indicated for the most common word length. The average word length will be the number of printable non whitespace characters (word characters) divided by the sum of the word counts of all lengths. Finally, the program should be divided into functions Using multiple functions instead of having the entire program in main) helps divide the program into more manageable parts and will also allow you to work on the program incrementally as well as facilitate the testing and debugging of any specific section of the program. Additionally functions can reduce the duplication of code within a program. It is up to you how to organize the program (one function for input, another for calculations, etc.) but a good rule of thumb is that you should be able to see the entire code of any function in your program on the screen without scrolling. 3. Note about input redirection To redirect stdin to read from a file (for example "inputFile.txt") instead of reading whatever the user types in, run the program with the following command (assuming the program binary is named "textFile : textFile Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started