please help me sos fortran program Input. txt includes the properties of the items inside a shipping container. The provided program below should sum up the total weight of the items inside the container and print it on the screen. The program is missing the expressions for variables is and ie. Complete the program by adding these expressions. input.txt ( Item: Organizer 35 compartments Weight: 109.5 Serial Number: 00245880 Status: in Item: 28 Morbylanga tables Weight: 699.3 Serial Number: 20293766 Status: in Item: 360m Mitted,LED chains Weight: 128.8 Serial Number: 90472514 Status: in Item: 2 Toyota Prado Weight: 2426.8 Serial Number: 00277989 Status: in Item: BRANAS, Laundry basket Q:28 Weight: 8.5 Serial Number: 202114731 Status: in program Program3PartA implicit none integer:: i,n,is,ie real:: total_weight,w character (len=100):: str open(10,file='Input.txt') total_weight=0.0; w=0; n=5 do i=1,n read(10,'(a)') str is= ie= read (str(is:ie),*) w total_weight=total_weight+w enddo print*, 'The total weight of the items in the container is:',total_weight end program Program3PartA partB Write a description (maximum three sentences) for the below subroutine. Specify what exactly the subroutine does, and what are the input/output arguments of the subroutine. subroutine sub(M) !-----------------------------------------------! ! description ! !-----------------------------------------------! real, dimension(:,:), intent(inout):: M real, dimension(:), allocatable:: tmp integer::i,j,n(2) n=shape(M) allocate(tmp(n(2))) do i=1,n(1) do j=i+1,n(1) if (sum(M(j,:)) > sum(M(i,:))) then tmp=M(i,:); M(i,:)=M(j,:); M(j,:)=tmp endif enddo enddo deallocate(tmp) end subroutine sub No hand written and fast answer with explanation
please help me sos fortran
Input. txt includes the properties of the items inside a shipping container. The provided
program below should sum up the total weight of the items inside the container and print it on the
screen. The program is missing the expressions for variables is and ie. Complete the program by
adding these expressions.
input.txt
(
Item: Organizer 35 compartments Weight: 109.5 Serial Number: 00245880 Status: in Item: 28 Morbylanga tables Weight: 699.3 Serial Number: 20293766 Status: in Item: 360m Mitted,LED chains Weight: 128.8 Serial Number: 90472514 Status: in Item: 2 Toyota Prado Weight: 2426.8 Serial Number: 00277989 Status: in Item: BRANAS, Laundry basket Q:28 Weight: 8.5 Serial Number: 202114731 Status: in
program Program3PartA
implicit none
integer:: i,n,is,ie
real:: total_weight,w
character (len=100):: str
open(10,file='Input.txt')
total_weight=0.0; w=0; n=5
do i=1,n
read(10,'(a)') str
is=
ie=
read (str(is:ie),*) w
total_weight=total_weight+w
enddo
print*, 'The total weight of the items in the container is:',total_weight
end program Program3PartA
partB
Write a description (maximum three sentences) for the below subroutine. Specify what exactly the
subroutine does, and what are the input/output arguments of the subroutine.
subroutine sub(M)
!-----------------------------------------------!
! description !
!-----------------------------------------------!
real, dimension(:,:), intent(inout):: M
real, dimension(:), allocatable:: tmp
integer::i,j,n(2)
n=shape(M)
allocate(tmp(n(2)))
do i=1,n(1)
do j=i+1,n(1)
if (sum(M(j,:)) > sum(M(i,:))) then
tmp=M(i,:); M(i,:)=M(j,:); M(j,:)=tmp
endif
enddo
enddo
deallocate(tmp)
end subroutine sub
No hand written and fast answer with explanation
Step by step
Solved in 4 steps