Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello Programming in Fortran (force 2) I have an input file myfile.txt where there are 53 rows and 8 column input file --------------------------------------------------------------------------------- year data1

Hello

Programming in Fortran (force 2)

I have an input file "myfile.txt" where there are 53 rows and 8 column

input file

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

year data1 data2 data3 S1 S2 S3 S4

2000 020201 2.0 23.0 3.5 6.3 5.2 4.9

2001 050362 3.2 66.0 0.0 2.9 5.0 6.0

....

2023 020503 1.2 72 5.0 0.0 5.3 0.0

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

now based on S1 S2 S3 S4 I have to calculate for every year the Sw where

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

Sw=200.3*S1+63.0-0.002, if 3.5=

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

Sw=193.2*S2+230-0.02 if 4=

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

Sw=190.2*S3+200-0.02 if 3.2=

Sw=100.1*S3+100-0.12 if 4=

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

Sw=200*S4+230-0.02 if 4=

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

Then I have to calculate a mean Sw(total) for every year where Sw(total)=sum(Sw(i)/er(i))/sum(1/er(i))

and then calculate the mean er (er(total))wher er(total)=n*sum(1/er(i) where n=the total data for every year !but for only the data they have been used. For example if in a row S3=0.0 or less than 4 (which is in the condition) then n shouldnt count it.

The output file has to have the following format (columns)

year data1 data2 data3 S1 S2 S3 S4 Sw1 Sw2 Sw3 Sw4 Sw(total) n er(total)

....

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

parameter(m=53,j=14)

do i=1,m do k=1,j A(i,k)=0.0 end do end do

open(7,file='Myfile.txt',status='old') open(8,file='output.out',status='unknown') read(7,*)

do l=1,m read(7,*)A(l,1),A(l,2),A(l,3),A(l,4),A(l,5),A(l,6),A(l,7), A(l,8) end do

then I put the if conditions (4 different if condition for every S) but I have problem calculate the Sw(total) the n and the er(total)

Please some help with the code??

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

How many things can be represented with eight binary bits?

Answered: 1 week ago