How well you break your program into appropriate functions

Assignment Help Applied Statistics
Reference no: EM133736014

Assignment: Program that Prints Some Statistical Results Worksheet

Write a program that reads a text file, then prints some statistical results about its contents to an output file. The results will be primarily an analysis of the characters in the file, which will include the frequency of occurrence of certain categories of characters, as well as the frequency of occurrences of each of the letters of the alphabet.

Note that in most standard English text, certain letters typically appear with a higher frequency than others. This kind of information has been used in setting up games like Scrabble (letter frequencies and point values, etc), as well as more serious applications like decoding encrypted messages and cyphers.

Task

1) Start by asking the user to input the name of the input file, and then to input the name of an output file. Whenever the user enters a filename that cannot be opened (both in the input and output cases), print an error message and ask the user to re-enter. (We've seen several code examples in the course notes that illustrate this). The input file can be ANY file containing plain text.

2) Read the contents of the input file, and then print to the OUTPUT file the following information about the contents of the input file:

a) A header stating a general heading and the name of the input file

b) The total number of characters contained in the file

c) A chart (with headings) where each row lists a category, the number of occurrences of that category of character, and the percentage of the total file this makes up. These are the catgegories:

i) Letters
ii) White space
iii) Digits
iv) Other

Note that the percentages in this chart should add up to 100%

d) A heading "LETTER STATISTICS"

e) Another chart (again, with headings), listing a category, the number of occurrences of that letter type, and the percentage of all LETTERS this comprises. This time, the categories are Uppercase letters, lowercase letters, and then each fo the individual letters of the alphabet (i.e. 26 of them). So this chart will have 28 rows

i) Note that the percentage of uppercase + lowercase should add up to 100%
ii) Also, the percentages of the 26 alphabet letters should add up to 100%
iii) Specifically, note that these are percentages of the total number of letters, NOT the total number of characters in the file

f) A heading "NUMBER ANALYSIS", followed by the count, sum, and average (to 2 decimal places) of all integer numbers appearing in the file, where a number is defined as any consecutive sequence of digits bounded by non-digits. Examples:

g) I am 14 years old and it is now 11:15 AM and my IP address is 123.45.0.204

In the above passge, there are 7 "numbers" (14, 11, 15, 123, 45, 0, and 204)

3) All percentages should be printed to two decimal places, along with a space and a % sign afterwards. Example: 12.45 %

4) Your headings and category labels should match mine (see example output files below). You may use whatever field widths you like, as long as your charts line up in neat columns (i.e. your spacing doesn't have to match mine exactly)

5) Category labels on your chart should be lined up on the left side of the words. All numbers in your charts should be lined up on the right side.

6) Hint: Instead of declaring 26 different variables to count each letter, consider using an array of counters

General Requirements

1) No global variables

2) You may use any of these libraries (no others):

a) iostream
b) iomanip
c) fstream
d) cctype

3) Write your source code so that it is readable and well-documented

4) Part of assessing readability and style will be how well you break your program into appropriate functions. Note: Breaking it up into functions makes for smaller, easier-to-code segments. You'll make your work easier if you do so.

Reference no: EM133736014

Questions Cloud

Design of a system that enforces operational interaction : Design of a system that enforces operational interaction, management, and incorporation of a coercive departmental effort across the organization
Planning on investing in high-speed train travel : Union Terminal is an example of how train travel can come back to life. The United States is planning on investing in high-speed train travel
Develop a strategic plan that targets the root causes : Develop a strategic plan that targets the root causes of inefficiencies. This plan could involve process optimization, technological upgrades
Assessment of the strategic and theological soundness : Analysis and assessment of the strategic and theological soundness of the HR practices of the subject company (paying special attention to HR strategy
How well you break your program into appropriate functions : Part of assessing readability and style will be how well you break your program into appropriate functions.
Adaptation strategy is only to be designed and implemented : 'An adaptation strategy is only to be designed and implemented when one wants to please one's counterpart'. How do you react to this statement?
What insight did you gain from taking this instrument : What insight did you gain from taking this instrument or what is your reaction? Why is the MBTI useful in industrial/organizational settings
Identification and development of acquisition workforce : The ACM's has multiple purposes for each government agency. One is to manage the identification and development of the acquisition workforce
Which mobile site can increase customer interaction : Describe an important way in which a mobile site can increase customer interaction. Responses The retailer can display inventory levels on hand at its distribut

Reviews

Write a Review

Applied Statistics Questions & Answers

  Hypothesis testing

What assumptions about the number of pedestrians passing the location in an hour are necessary for your hypothesis test to be valid?

  Calculate the maximum reduction in the standard deviation

Calculate the maximum reduction in the standard deviation

  Calculate the expected value, variance, and standard deviati

Calculate the expected value, variance, and standard deviation of the total income

  Determine the impact of social media use on student learning

Research paper examines determine the impact of social media use on student learning.

  Unemployment survey

Find a statistics study on Unemployment and explain the five-step process of the study.

  Statistical studies

Locate the original poll, summarize the poling procedure (background on how information was gathered), the sample surveyed.

  Evaluate the expected value of the total number of sales

Evaluate the expected value of the total number of sales

  Statistic project

Identify sample, population, sampling frame (if applicable), and response rate (if applicable). Describe sampling technique (if applicable) or experimental design

  Simple data analysis and comparison

Write a report on simple data analysis and comparison.

  Analyze the processed data in statistical survey

Analyze the processed data in Statistical survey.

  What is the probability

Find the probability of given case.

  Frequency distribution

Accepting Manipulation or Manipulating

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd