Docsity

Linear Equations Assignment 03 in CSCI 230 Fall-2006, Assignments of Computer Science

Toggle sidebar
bg1
CSCI 230 Assignment 03 Due: 09/28/2006 (Thr)
Fall-2006 (100 pts)
Linear Equations (Functions)
Part I (40 points)
Complete the problems on Page 2 of this assignment.
Part II (60 points)
Write a well-structured program (in FORTRAN), named Prog03.for, that reads values
for the coefficients A, B, C, and D of the following two linear lines (functions),
y = Ax + B
y = Cx + D
Then, determine whether the lines are parallel (their slopes are equal) or the lines
intersect. If the lines intersect, determine if they are perpendicular (the product
of their slopes is equal to B1). Terminate the execution of your program when the
values of all coefficients, (A, B, C, and D), are the zero (0.0).
[Note that this assignment is Programming Problem 3, pp. 173-174, modified.]
1. From the course web page (http://www.cs.niu.edu/~sjchung),
copy Prog03.in, Prog03.sjc, and Prog03.hlp into your F directory.
Prog03.ref is a file that you can download as your Prog03.for and finish it.
2. Write your Prog03.for (or finish it from Prog03.ref as mentioned above).
3. Compile & Link/Edit your Prog03.for to get Prog03.obj & Prog03.exe.
4. Test your program with input data of your own choice.
5. Run your Prog03.exe by: Prog03 < Prog03.in > Prog03.out
6. Your Prog03.out should compare correctly to Prog03.sjc.
7. Hand in:
1) Page 2 of this assignment after you have complete the problem.
2) Printed copies of your Prog03.for & Prog03.out
3) Your 3.5@ diskette containing your Prog03.for, Prog03.obj, Prog03.exe,
and Prog03.out
pf3

Partial preview of the text

Download Linear Equations Assignment 03 in CSCI 230 Fall-2006 and more Assignments Computer Science in PDF only on Docsity!

CSCI 230 Assignment 03 Due: 0 9 / 28 / 200 6 (Thr)

Fall-200 6 ( 100 pts)

Linear Equations (Functions)

Part I ( 4 0 points)

Complete the problems on Page 2 of this assignment.

Part II ( 6 0 points)

Write a well-structured program (in FORTRAN), named Prog03.for, that reads values for the coefficients A, B, C, and D of the following two linear lines (functions), y = Ax + B y = Cx + D Then, determine whether the lines are parallel (their slopes are equal) or the lines intersect. If the lines intersect, determine if they are perpendicular (the product of their slopes is equal to B1). Terminate the execution of your program when the values of all coefficients, (A, B, C, and D), are the zero (0.0). [Note that this assignment is Programming Problem 3, pp. 173-174, modified.]

  1. From the course web page (http://www.cs.niu.edu/~sjchung), copy Prog03.in, Prog03.sjc, and Prog03.hlp into your F directory. Prog03.ref is a file that you can download as your Prog03.for and finish it.
  2. Write your Prog03.for (or finish it from Prog03.ref as mentioned above).
  3. Compile & Link/Edit your Prog03.for to get Prog03.obj & Prog03.exe.
  4. Test your program with input data of your own choice.
  5. Run your Prog03.exe by: Prog03 < Prog03.in > Prog03.out
  6. Your Prog03.out should compare correctly to Prog03.sjc.
  7. Hand in:
    1. Page 2 of this assignment after you have complete the problem.
    2. Printed copies of your Prog03.for & Prog03.out
    3. Your 3.5@ diskette containing your Prog03.for, Prog03.obj, Prog03.exe, and Prog03.out

Due: 0 9 / 28 / 200 6 (Thr) CSCI 230 Assignment 03 Name:___________,_________ Fall-200 6 Linear Equations (Functions) (Last:spell) (First) Part I ( 4 0 points)

  1. Apply the De Morgan=s Laws to fill in the following blanks: .NOT. ((a .EQ. 0.0) .AND. (b .EQ. 0.0)) = (a _____ 0.0) _____ (b _____ 0.0)
  2. Consider two linear functions: y = Ax + B Line 1 y = Cx + D Line 2 where each of the 4 coefficients, A, B, C and D can be zero or non-zero, thus a total of 16 possibilities. Complete the following table: A B C D Line 1 Line 2 Lines 1 & 2

1 0.0 0.0 0.0 0.0 y = 0.0 y = 0.0 Parallel: Horizontal 2 0.0 0.0 0.0 not y = 0.0 y = D Parallel: Horizontal 3 0.0 0.0 not 0.0 y = 0.0 y = Cx Intersect at (0,0) 4 0.0 not 0.0 0.0 y = B y = 0.0 Parallel: Horizontal 5 not 0.0 0.0 0.0 y = Ax y = 0.0 Intersect at (0, 0) 6 0.0 0.0 not not y = 0.0 y = Cx + D Intersect at (-D/C,0) 7 0.0 not 0.0 not y = B y = D Parallel: Vertical or Horizontal? _______ 8 not 0.0 0.0 not y = Ax y = D Intersect at _________ 9 0.0 not not 0.0 y = B y = Cx Intersect at _________ 

10 not 0.0 not 0.0 y = Ax y = Cx Parallel if __________ Perpendicular if __________ 11 not not 0.0 0.0 y = Ax + B y = 0.0 Intersect at _________ 12 0.0 not not not y = B y = Cx + D Intersect at _________ 13 not 0.0 not not y = Ax y = Cx + D Parallel if ________ Perpendicular if ________ 14 not not 0.0 not y = Ax + B y = D Parallel if _________ Perpendicular if __________ 15 not not not 0.0 y = Ax + B y = Cx Parallel if _________ Perpendicular if __________ 16 not not not not y = Ax + B y = Cx + D Parallel if _________ Perpendicular if _________ 2