Question

use FORTRAN functions to do the partial calculations for the sums AND read the data from...

use FORTRAN functions to do the partial calculations for the sums
AND read the data from the data le named data.dat according to the following speci cations using
functions f1 and f2:
(1) internal function f1 nds the correct value to sum for devices "A", "B", and "C"
(2) external function f2 nds the correct value to sum for devices "D" and "E"
A partial FORTRAN 90 program to accomplish the goals of this problem follows:
!lab 3(b) solution by <STUDENT NAME>
program lab3_b
implicit none
character ::code
integer::ic
integer :: InputStatus,OpenStatus
real :: sumA=0.0,sumB=0.0,sumC=0.0,sumD=0.0,sumE=0.0
real v1,v2,val
integer :: low,high
print *, "lab 3(b) solution by <STUDENT NAME>"
OPEN (UNIT = 15
IF (OpenStatus > 0) STOP "*** Cannot open the file ***"
do
read(15,"(
if( )exit
if(InputStatus >0)stop "***Input Error***"
write(*,"(
select case (code)
case('A')
low=20; high=70
val=f1(ic,low,high,v1,v2)
sumA=sumA+val
case ('B')
low=30; high=60
val=
sumB=sumB+val
case ('C')
low=50; high = 90
val=
sumC=sumC+val
case ('D')
low=50
val=f2(ic,low,v1,v2)
sumD=sumD+val
case ('E')
low=30
val=
sumE=sumE+val
print *, "sumA=",sumA
print *, "sumB=",sumB
print *, "sumC=",sumC
print *, "sumD=",sumD
print *, "sumE=",sumE
contains
function f1(ic,l,h,m1,m2)
end function f1
end program lab3_b
function f2(ic,l,m1,m2)
end function f2
Starting with the above partial code, complete the solution to this problem. DO NOT USE ANY
VARIABLES BEYOND THOSE DECLARED. ADD TO, BUT DO NOT ALTER THE PARTIAL
CODE PROVIDED EXCEPT TO FILL IN YOUR INDIVIDUAL NAME IN THE PARTS BE-
TWEEN THE ANGLE BRACKETS.
Provide test results for the data le:
B352.7842 4.125
E872.2169 1.552
B233.0701-18.632
C430.2527 -8.303
E823.9633-10.777
D702.7719 4.000
E944.0838 19.593
D683.4771-10.273
A123.1718 -6.549
A172.1525 15.136
E821.1579-14.504
B384.3084 15.267
A152.1735 -3.410
E863.7962 -4.978
B252.3949 18.347
D742.8008-15.528

0 0
Add a comment Improve this question Transcribed image text
Answer #1

::cade integer::ic real v1,v2.val print *lab 3(b) solution by KSTUDENT NAME> OPEN (15.FILE = da t a . da. ,STATUS=NEW ,Flow 50 high90 valaf i (ic,low,high,v1,v2)//filled case D) val f2 (ic,low,v1,v2) (E) val f 2 (ic,low,v1,v2)//f2 is also fil

Add a comment
Know the answer?
Add Answer to:
use FORTRAN functions to do the partial calculations for the sums AND read the data from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that demonstrates use of programmer - defined data structures. Please provide code! Thank...

    Write a program that demonstrates use of programmer - defined data structures. Please provide code! Thank you. Here are the temps given: January 47 36 February 51 37 March 57 39 April 62 43 May 69 48 June 73 52 July 81 56 August 83 57 September 81 52 October 64 46 November 52 41 December 45 35 Janual line Iranin Note: This program is similar to another recently assigned program, except that it uses struct and an array of...

  • Write a c++ program ******​IMPORTANT NOTE: DO NOT USE DO NOTTT USE POINTERS,STRING LIBRARY, PRINTF AND...

    Write a c++ program ******​IMPORTANT NOTE: DO NOT USE DO NOTTT USE POINTERS,STRING LIBRARY, PRINTF AND SCANF************* Part A Create a program that does the following: 1 Create a two-dimensional array of characters that has 78 rows, each of which will store, with an initialization list, the name of a PR municipality. Be sure to indicate the number of columns in this array large enough to fit the longest name, considering there must be a space for the ' 0...

  • IN PYTHON PLEASE...... Process bowlers and their 3 bowling scores. Use my data file below: bowlers2.txt...

    IN PYTHON PLEASE...... Process bowlers and their 3 bowling scores. Use my data file below: bowlers2.txt ( Showed below) And you can also use a while loop to read your file if you prefer. How to average down an array, which you don’t have to do. In this case that would be the game 1 average for all bowlers for example. Find the low average and high average. Start with read the data into arrays/lists and printed out the arrays/lists...

  • Please use Java to write the program The purpose of this lab is to practice using...

    Please use Java to write the program The purpose of this lab is to practice using inheritance and polymorphism. We need a set of classes for an Insurance company. Insurance companies offer many different types of policies: car, homeowners, flood, earthquake, health, etc. Insurance policies have a lot of data and behavior in common. But they also have differences. You want to build each insurance policy class so that you can reuse as much code as possible. Avoid duplicating code....

  • Mountain Paths (Part 1) Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e...

    Mountain Paths (Part 1) in C++ Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e. parallel arrays … called multiple arrays in the zyBook) Transform data Read from files Write to files structs Code Requirements Start with this code: mtnpathstart.zip Do not modify the function signatures provided. Do not #include or #include Program Flow Read the data into a 2D array Find min and max elevation to correspond to darkest and brightest color, respectively Compute the shade of...

  • CMPS 12B Introduction to Data Structures Programming Assignment 2 In this project, you will write...

    can i get some help with this program CMPS 12B Introduction to Data Structures Programming Assignment 2 In this project, you will write a Java program that uses recursion to find all solutions to the n-Queens problem, for 1 Sns 15. (Students who took CMPS 12A from me worked on an iterative, non-recursive approach to this same problem. You can see it at https://classes.soe.ucsc.edu/cmps012a/Spring l8/pa5.pdf.) Begin by reading the Wikipcdia article on the Eight Queens puzzle at: http://en.wikipedia.org/wiki/Eight queens_puzzle In...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT