Question
Work: Evaluating Halsteads Metrics 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
Work: Evaluating Halsteads Metrics
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 |
Identify all operators (including the End-Of-Statement EOS operators, ) and their frequencies. Put operators 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) =
Identify all operands and their frequencies. Put operands 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) =
Following the Halsteads 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) ) / 30
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started