473,434 Members | 1,523 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,434 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 4193
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.