Lab 2: Circuit with serial resistors


Name _____________________                  Student ID___________________

Purposes
  1. be familiar with basic Fortran programming concepts.
  2. practice the four step problem solving process.
  3. practice the basic Fortran programming using an example program.
  4. practice the compile and execution process.

Problems

1. (Page 109, problem 1) For three resistors connected in series, the total resistance is the sum of the individual resistances.  Modify this program  calculate and display the current in a circuit in which the three resistors are connected in series.

2. (Page 109, problem 2) For the circuit like that in problem 1, the voltage across one of the resistors R1, R2 and R3 is given by Ri*I, i=1, 2, 3, where I is the current in the circuit, implement a program to calculate the voltage across each of the resistors.

Requirement

1. Complete the pre-lab exercises (in next page) before you entering in the lab. Help is available during the tutoring hours and office hours.

2. In the lab time, follow the In-Lab instruction to finish the lab practice. Record the required information as lab report.

3. Demo your lab program for the instructor or the TA. Submit your pre-lab exercise and the lab report.



Pre-Lab Exercise

1.
Analyze problem 1 and write down the specification of the problem, including the input and output.

What is the problem?


What is the input information?


What is the output information?



2. Read the given program for problem 1, draw a flow chart to represent the procedure that is implemented in the program.


























3. What is the given program doing? How to modify it so you can use it to solve problem 1?





4. Analyze problem 2 and write down the specification of the problem, including the input and output.

What is the problem?


What is the input information?


What is the output information?




5. Draw a flow chart to represent the procedure to solve problem 2.
























5. Compare the flow chart in question 4 and the flow chart you have for question 3, what is the difference? How to modify the program for problem 1 so that you can have a program to solve problem 2?




















In-Lab Instruction

1. Create a new folder lab2 in CIS261 that you created in lab 1, use this folder to save files for this lab. You should create a different folder for each lab and homework.

2. Download this program by copying and paste it into a new file in lab2, with Notepad. Modify this program to calculate and display the current in a circuit in which the three resistors are connected in series.

3. Compile and execute the modified program, test it with two groups of  input data, write down your input  data and the output results in the table below.



Test 1
Test 2
Input
R1



R2



R3



V


Output
Current





4. Implement a program to solve problem 2, according to your answers to the pre-lab exercises. You can use the program code you have had for problem 1, copy it to another file and work on the new file.

5. Execution and test the program for problem 2, test it with two groups of input data, write down your input  data and the output result in the table below.



Test 1
Test 2
Input
R1



R2



R3



V


Output
V1



V2



V3