FloridaTech - College of Engineering

CSE1001 - LABORATORY


Lab Assignment 15 : Arrays


To be submitted in the lab

Problem :
Part 1

Write a program that calculates the mean and standard deviation of integers stored in a file. The output should be of type Float and should be properly labelled and formatted to two decimal places. The formula for calculating the mean of a series of integers is to add all the numbers, then to divide by the number of integers. Expressed in mathematical terms, this is

                         X = (x1 + x2 + x3 ...........+xn)/ n

          

To claculate the standard deviation of a series of integers, subtract the mean from each integer (you may get a negative number) and square the results; add all these squared differences; divide by the number of integers minus one; then take the square root of teh result. Expressed in mathematical terms, this is

                         Y =  (x1-X)2 + (x2-X)2 + (x3-X)2 + (x4-X)2.......+ (xn-X)2/ n-1
                               
                         S =  Y1/2

Use the square-root function from your Ada compiler's predefined math package.

Example

Example of Square root


Part 2 :

Write an Ada program to determine whether or not any two consecutive lines typed at the keyboard are anagrams of each other. Two lines are anagrams of one another if they contain exactly the same characters in different order. For example, the following two lines are anagrams.

Mildred Smedley
slid remedy meld

Echo the lines after both have been read. Then print one of the following messages followed by three blank lines:

The above two lines are anagrams !
The above two lines are not anagrams!

You must assume that no line contains more than 80 characters. You may also assume that the only characters in the lines are the 26 upper- and lowercase characters of the alphabet and the blank character. Ignore blanks in the input. Consider equivalent upper- and lowercase letters to be equal. Terminate your program when the first line of the pair contains less than two characters.

Helpful Stuff : Use Arrays


Professor:Dr.Stansifer
G.S.A : Rishi Gupta
Last Modified :4/25/99