Can Örs
010980058



Menu


:.Ana Sayfa»

:.Kategoriler»
:.Forum»
:.Info»
:.Mail»

Final Exam
1.The normal probability function φ is defined as:

Write a program to evaluate φ(x) for values of x from -2.0 to 2.0, and store these in array. Display the results in a table with five values to a line.

2.Write a program to read a date in the International Standard form (yyyy-mm-dd) and print message to indicate whether on this date in Sydney, Australia, it will be winter, spring, summer or autumn. For the purpose of this exercise we shall assume that winter consists of June and July, that spring is August; September and October, that summer is from November until March, and that autumn is April and May.
(Hint: select case structure will be used)

3.Acceleration for a body was measured in the experiments by using accelerometer as a time series. Acceleration values regarding to the time as saved in the computer by the name of acceleration.txt. Format of the acceleration are given as follow. Write program that calculate force time series an print that results as a file by the name of force.txt with time domain. (In the program, mass of the body is constant as 15 kg (SI unit system). (As a knowledge Newton second law is F=m*a)

acceleration.txt
time(s)
acceleration(m/sec2)
0
9
0.5
9.2
1
9.8
1.5
10.5
2
11.4
2.5
10.1
3
9.7
3.5
8.5
4
8.4
4.5
7.5
5
7.1

4.Find syntax errors in the following program.
!this program is calculates distance
between two points
program distance
use distance/m
print *, "enter coordinates of two points"
read *, x1,y1,x2,y2
real::x1,y1,x2,y2,d
d=dist(x1,y1,x2,y2)
print *, "x1=",x1, "y1=",y1
print*,"x2=",x2,"y2=",y2
print *, "distance=",distance
endprogram length
module distance_m
public::dist
function dist(x1,y1,x2,y2)result (d)
real, intent(in)::x1,y1,y2
real::d
d=squareroot ((x2-x1)**2+(y2-y1)**2)
return
endfunction dist
end module distance_m

Results:
1.
Let's suppose the interval of the input values is 0.0625, so we have 65 values;
Sourcecode of the program (normal_prob.txt)

2.
Sourcecode of the program (season.txt)

3.
Sourcecode of the program (nslm.txt)
acceleration.txt
force.txt

4.
Program section:
a)There should be ! before between two points
b) use distance/m should be use distance_m, we may not use character /
c)The decleration real::x1,y1,x2,y2,d should be before print*, "enter coordinates of two points"
d)We did not declared distance in print*,"distance=",distance, so it should be print*,"distance=",d
e)endprogram length should be endprogram distance

Module section:
a)There should be contains after public::dist
b)x2 is not declared real,intent(in)::x1,y1,y2 should be real,intent(in)::x1,x2,y1,y2
c)There is no intrinsic function such as squareroot in Fortran, so it should be d=sqrt ((x2-x1)**2+(y2-y1)**2) instead of d=squareroot((x2-x1)**2+(y2-y1)**2)





Valid HTML 4.01!Install Cortona VRML Client!Get Adobe ReaderGIMP - Free7-ZipGet Firefox
Copyright © Can Örs 2002-2005.Lütfen okuyun.