473,394 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Manipulating numbers in a file

I really need help with one my program; it is about arraylist; I do not get it. Can someone please help me with it?

Here's the instruction:

1. Your instructor will provide you with a text file, (numbers.txt), containing a large (N <= 1000) number of integers. The integers range in value from 0 to 100. The text file has been created with one value on each line. Due to the potential for the sum of the numbers to be very large, you should use a long integer in your calculation to find the average.

2. The number of integers in the file is unknown.

3. Your program must find the average, standard deviation, and mode of the list of numbers. The mode is defined as the value(s) present with the highest frequency. Calculating the standard deviation consists of the following steps:

a. Find the average of the list of numbers.
b. Determine the difference of each number from the average, and square each difference. Sum all the differences.
c. Divide this sum by (the number of values - 1).
d. Take the square root of the above division result from step c.

Example, given this list of numbers: 7 4 5 9 10

a. The average = 7
b. Sum of square of differences:

(7 - 7)2 + (4 - 7)2 + (5 - 7)2 + (9 - 7)2 + (10 - 7)2
0 + 9 + 4 + 4 + 9 = 26

c. 26(5-1) = 6.50

d. 6.50 = 2.55

4. For a normal distribution, 68.3% of the data will lie within one standard deviation of the average, while 95.4% will lie within two standard deviations.

Thx.
Mar 13 '07 #1
2 4191
sicarie
4,677 Expert Mod 4TB
I really need help with one my program; it is about arraylist; I do not get it. Can someone please help me with it?

Here's the instruction:

1. Your instructor will provide you with a text file, (numbers.txt), containing a large (N <= 1000) number of integers. The integers range in value from 0 to 100. The text file has been created with one value on each line. Due to the potential for the sum of the numbers to be very large, you should use a long integer in your calculation to find the average.

2. The number of integers in the file is unknown.

3. Your program must find the average, standard deviation, and mode of the list of numbers. The mode is defined as the value(s) present with the highest frequency. Calculating the standard deviation consists of the following steps:

a. Find the average of the list of numbers.
b. Determine the difference of each number from the average, and square each difference. Sum all the differences.
c. Divide this sum by (the number of values - 1).
d. Take the square root of the above division result from step c.

Example, given this list of numbers: 7 4 5 9 10

a. The average = 7
b. Sum of square of differences:

(7 - 7)2 + (4 - 7)2 + (5 - 7)2 + (9 - 7)2 + (10 - 7)2
0 + 9 + 4 + 4 + 9 = 26

c. 26(5-1) = 6.50

d. 6.50 = 2.55

4. For a normal distribution, 68.3% of the data will lie within one standard deviation of the average, while 95.4% will lie within two standard deviations.

Thx.
Sure, what part don't you get? What have you tried?
Mar 13 '07 #2
r035198x
13,262 8TB
I really need help with one my program; it is about arraylist; I do not get it. Can someone please help me with it?

Here's the instruction:

1. Your instructor will provide you with a text file, (numbers.txt), containing a large (N <= 1000) number of integers. The integers range in value from 0 to 100. The text file has been created with one value on each line. Due to the potential for the sum of the numbers to be very large, you should use a long integer in your calculation to find the average.

2. The number of integers in the file is unknown.

3. Your program must find the average, standard deviation, and mode of the list of numbers. The mode is defined as the value(s) present with the highest frequency. Calculating the standard deviation consists of the following steps:

a. Find the average of the list of numbers.
b. Determine the difference of each number from the average, and square each difference. Sum all the differences.
c. Divide this sum by (the number of values - 1).
d. Take the square root of the above division result from step c.

Example, given this list of numbers: 7 4 5 9 10

a. The average = 7
b. Sum of square of differences:

(7 - 7)2 + (4 - 7)2 + (5 - 7)2 + (9 - 7)2 + (10 - 7)2
0 + 9 + 4 + 4 + 9 = 26

c. 26(5-1) = 6.50

d. 6.50 = 2.55

4. For a normal distribution, 68.3% of the data will lie within one standard deviation of the average, while 95.4% will lie within two standard deviations.

Thx.
Check out our posting guidelines. We are willing to help only if you show some effort in doing the work yourself first.
Mar 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: August1 | last post by:
A handful of articles have been posted requesting information on how to use these functions in addition to the time() function as the seed to generate unique groups (sets) of numbers - each group...
10
by: Kristian Nybo | last post by:
Hi, I'm writing a simple image file exporter as part of a school project. To implement my image format of choice I need to work with big-endian bytes, where 'byte' of course means '8 bits', not...
2
by: darrel | last post by:
can asp.net handle hex values natively? I'd like to make a tint of a color spec'd as hex. For instance, turning ffcc33 into eebb22 Can .net do that natively, or do I need to manually translate...
2
by: Ido Flatow | last post by:
Hi all, I've been exploring the way I can manipulate WSDL.exe using SchemaImporterExtension in order to create a proxy to my liking. My situation is as follows - I have a web site that has...
29
by: Halid Umar A M | last post by:
Hi All, I m Halid Umar, network security research student. I will explain my situation and give me hint if you can. I expect reply from you all. * I have to handle numbers that have more than...
10
by: LuTHieR | last post by:
Hi, I'm reading a string of numbers from a file (using Borland C++ Builder 6), and I'm doing it like this: first I use FileRead to store all the data in the file to a char* variable (appropriately...
5
by: lim4801 | last post by:
I am currently in doing a program which is given by my tutor: Contemplate that you are working for the phone company and want to sell "special" phone numbers to companies. These phone numbers are...
4
by: GoguLKS | last post by:
Hi, I am trying to manipulate a XSLT variable. Manipulating is replacing the string value in it. My XML file looks like: <root> <item name="PageTitle"> <value>Screen Page<value/>...
3
by: ogo796 | last post by:
hi there! i have a problem manipulating a text file using php. I want to write information posted from an html form. from the example below i want to upload the file and it must be under the specific...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.