1. Engineering
  2. Computer Science
  3. the fortran program of calculating the fibonacci numbers is shown...

Question: the fortran program of calculating the fibonacci numbers is shown...

Question details

The FORTRAN program of calculating the Fibonacci numbers is shown below [1]:

PROGRAM fbnc

c

Fibonacci sequence

integer f1,f2,f3

f1=1                 □

f2=1                 □

write(*,*)'To display Fibonacci numbers.'       □

write(*,*)'Enter the number of terms to be displayed:'          □

read(*,*)n           □

write(*,*)'The Fibonacci sequence is : '        □

IF(n.EQ.1)THEN       □

write(*,10)f1        □

10

format(1x,I6)

ELSE                 □

write(*,10)f1        □

write(*,10)f2        □

DO 20 i=3,n         □

f3=f1+f2             □

write(*,10)f3        □

f1=f2                □

f2=f3                □

20

continue             □

ENDIF                □

STOP                 □

END                  □

  1. Identify all operators (including the End-Of-Statement EOS operators,) and their frequencies. Put operator’s names and their frequency values in Table 1below:

TABLE 1: Operators and their Frequencies

No.

Operator

Frequency, f1

Based on this data (from Table 1), estimate total number of unique operators, n1, and the total number of operators appearance, N1:

n1 =

N1 = SUM(f1) =

  1. Identify all operands and their frequencies. Put operand’s names and their frequency values in Table 2 below:

TABLE 2: Operands and their Frequencies

No.

Operand

Frequency, f2

Based on this data (from Table 2), estimate total number of unique operands, n2, and the total number of operands appearance, N2:

n2 =

N2 = SUM(f2) =

  1. Following the Halstead’s metrics definitions [2-3], estimate the following metrics:

The program length (N): N = N1 + N2

The vocabulary size (n): n = n1 + n2

The program volume (V): V = N * log2(n)

The difficulty level or error proneness (D) of the program: D = ( n1 / 2 ) * ( N2 / n2 )

The program level (L): L = 1 / D

The effort to implement (E) or understand a program: E = V * D

The time to implement or understand a program (T): T = E / 18

The number of delivered bugs (B): B = ( E^(2/3) ) / 3000
(here the symbol ^ stands for "to the exponent")

  1. Make comments on estimates of implementation of this algorithm in any other programming language that you are familiar with.
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution