Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ . Analyzing Data without USING ARRAYS. Write a program named Lab3c.cpp . The program can process the numbers stored in a file and provide

C++ . Analyzing Data without USING ARRAYS.

Write a program named Lab3c.cpp. The program can process the numbers stored in a file and provide a report about the numbers.

The program processes the numbers stored in a file and provides a report about the numbers.

Check. Make sure there is a program description at the top of your source code.

Open The Input File

Open the file named "Random.txt". Note, you need to place the file in the proper place where the executable can read. On Xcode, find out where the executable is and place the input file in the same path where the executable is located. Use a named string constant in uppercase for the file name.

Check. Make sure there is a named string constant in uppercase for the file name and the named constant is used in the source code whenever a file name is required.

Process The Data

Read all numbers stored in the file. While reading the numbers, keep track of the following records about the numbers:

A) The count of all the numbers in the file.

B) The sum of all the numbers in the file.

C) The average of all the numbers in the file.

D) The largest number of all the numbers in the file.

E) The smallest number of all the numbers in the file.

To keep track of those statistics about the numbers, define several variables and initialize them properly in the definitions. Use proper types for the variables. For the variables used to keep track of the largest number and the smallest number, read the first number from the file and use that number to set the variables. You'll use a loop construct to accomplish the rest of the reading. When a new number is read from the file, update the variables.

Whenever a cast is needed, use the C++ style casting with the keyword static_cast.

Check. Make sure the variables are defined using proper names and initialized using proper values (0 for integers and 0.0 for doubles.)

Check. Make sure the first assumptions of the largest and the smallest numbers are the first number from the file.

Check. Make sure all castings are done using static_cast.

Report

After all the calculations are done, the program reports the results from A to E on the display. Format the report using proper manipulators. The report should be exactly as follows:

Summary of Random.txt ======================= Count: 200 Sum: 105527 Average: 527.63 Max: 1000 Min: 7 

Check. Make sure report is formatted as shown using manipulators.

Check. Make sure there is a C++ comment above each section you have accomplished above.

Here is the link for Random.txt file: http://puma.deanza.fhda.edu/distribute/yehsh/cis-22a/Samples/Random.txt

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions