Question: Re-engineering and refactor the fortran 90 code to new construction in fortran 95. ----------------------- * CODE : program luc implicit integer (a-z) data handle/0/ dimension

Re-engineering and refactor the fortran 90 code to new construction in fortran 95.

Re-engineering and refactor the fortran 90 code to new construction in fortran

-----------------------

95. ----------------------- *CODE: program luc implicit integer (a-z) data handle/0/ dimension k(0:7,0:15),m(0:7,0:7,0:1)

*CODE:

program luc implicit integer (a-z) data handle/0/ dimension k(0:7,0:15),m(0:7,0:7,0:1) dimension key(0:127), message(0:127) equivalence (k(0,0),key(1)),(m(0,0,0),message(1))

dimension kb(0:31),mb(0:31) write(*,1003) read(*,1004) (kb(i),i=0,31)

write(*,1005) read(*,1006) (mb(i),i=0,31)

call expand(message,mb,32) call expand(key,kb,32)

write(*,1000) (key(i), i=0,127) write(*,1001) (message(i), i=0,127)

d=0 call lucifer(d,k,m)

d=1 call lucifer(d,k,m)

write(*,1001) (message(i),i=0,127)

call compress(message,mb,32) call compress(key,kb,32) write(*,1003) write(*,1007) (kb(i),i=0,31) write(*,1005) write(*,1007) (mb(i),i=0,31)

1000 format(' key '/16(1x,i1)) 1001 format(' plain '/16(1x,i1)) 1002 format(' cipher '/16(1x,i1)) 1003 format(' key ')

1004 format(32z1.1) 1005 format(' plain ') 1006 format(32z1.1) 1007 format(1x,32z1.1) end

program luc implicit integer (a-z) data handle/0/ dimension k (0:7,0:15), m (0:7,0:7,0:1) dimension key (0:127), message (0:127) equivalence (k (0,0), key (1) ), (m(0,0,0), message (1)) dimension kb (0:31),mb (0:31) write(*, 1003) read(*,1004) (kb(i),i=0,31) write(* , 1005) read(*,1006) (mb(i),1-0,31) call expand (message, mb, 32) call expand (key, kb, 32) write(, 1000) (key (i), i-0,127) write(,1001) (message(i), i-0,127) d=0 call lucifer (d, k,m) d-1 call lucifer (d, k,m) write(*,1001) (message (i), i=0,127) call compress (message, mb, 32) call compress (key, kb, 32) write(* , 1003) write (* 1007) (kb (i),i=0, 31) write(*, 1005) write(,1007) (mb(i), -0,31) 1000 format(' key '/16 (1x, il)) 1001 format(' plain '/16 (1x, il) ) 1002format(' cipher '/16 (1x, il)) 1003 format("key) 1004 1005 1006 1007 format (32z1.1) format(' plain') format (3221.1) format (1x, 3221.1) end Re-engineering: Make sure to convert/remove any structures which are relevant/irrelevant, via refactoring and restructuring. Your code should be clean and easy to understand (unlike the existing code). The program may contain structures which should be modified or removed to make the program more maintainable. Some examples include: GOTO statements, equivalence statements, arithmetic IF statements, and label-enabled looping structures. Structures such as arrays, and strings should also be modified to newer constructs. Note that to remove the equivalence statement requires the arrays to be reshaped (using the function reshape()). program luc implicit integer (a-z) data handle/0/ dimension k (0:7,0:15), m (0:7,0:7,0:1) dimension key (0:127), message (0:127) equivalence (k (0,0), key (1) ), (m(0,0,0), message (1)) dimension kb (0:31),mb (0:31) write(*, 1003) read(*,1004) (kb(i),i=0,31) write(* , 1005) read(*,1006) (mb(i),1-0,31) call expand (message, mb, 32) call expand (key, kb, 32) write(, 1000) (key (i), i-0,127) write(,1001) (message(i), i-0,127) d=0 call lucifer (d, k,m) d-1 call lucifer (d, k,m) write(*,1001) (message (i), i=0,127) call compress (message, mb, 32) call compress (key, kb, 32) write(* , 1003) write (* 1007) (kb (i),i=0, 31) write(*, 1005) write(,1007) (mb(i), -0,31) 1000 format(' key '/16 (1x, il)) 1001 format(' plain '/16 (1x, il) ) 1002format(' cipher '/16 (1x, il)) 1003 format("key) 1004 1005 1006 1007 format (32z1.1) format(' plain') format (3221.1) format (1x, 3221.1) end Re-engineering: Make sure to convert/remove any structures which are relevant/irrelevant, via refactoring and restructuring. Your code should be clean and easy to understand (unlike the existing code). The program may contain structures which should be modified or removed to make the program more maintainable. Some examples include: GOTO statements, equivalence statements, arithmetic IF statements, and label-enabled looping structures. Structures such as arrays, and strings should also be modified to newer constructs. Note that to remove the equivalence statement requires the arrays to be reshaped (using the function reshape())

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!