Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

image text in transcribed

*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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Office 365 For Beginners 2022 8 In 1

Authors: James Holler

1st Edition

B0B2WRC1RX, 979-8833565759

More Books

Students also viewed these Databases questions