# Computing

## CONTENTS OF CURRICULUM UNIT 81.06.04

- Introduction
- The Meaning of Area
- Area of a Rectangle
- Computer Programs to Calculate the Area of a Rectangle
- Area of a Square
- Computer Programs to Calculate the Area of a Square
- Area of a Parallelogram
- Computer Programs to Calculate the Area of a Parallelogram
- Area of a Triangle
- Computer Program to Calculate the Area of a Triangle
- Area of a Trapezoid
- Computer Program to Calculate the Area of a Trapezoid
- Bibliography for Teachers
- Student Reading List

### Unit Guide

## Introducing Computer Programming in a Traditional Classroom

Your feedback is important to us!

After viewing our curriculum units, please take a few minutes to help us understand how the units, which were created by public school teachers, may be useful to others.

*
Computer Program to Calculate the Area of a Trapezoid
*

Program8introduces the concept of sorting a set of numbers into ascending order - 10 REM FIND THE AREA OF N TRAPEZOIDS AND ARRANGE THE
- 11 REM AREAS IN ORDER FROM SMALLEST TO LARGEST
- 20 DIM A(100), H(100) U(100), L(100)
- 25 PRINT “ALTITUDE”, “UPPER BASE”, “LOWER BASE”, “AREA”
- 30 PRINT
- 32 REM A = AREA, H= ALTITUDE, U= UPPER BASE, L = LOWER BASE
- 40 READ N
- 50 FOR I=1 TO N
- 60 READ H(I), U(I), L(I)
- 70 LET A(I)= H(I) * (U(I) + L(I))/2
- 80 PRINT H(I), U(I), L(I), A(I)
- 85 NEXT I
- 100 PRINT “THE AREAS ARRANGED IN ASCENDING ORDER ARE:”
- 120 FOR I = 1 TO N
- 130 FOR J = I + 1 TO N
- 140 IF A(I) A(J) THEN 180
- 150 LET Q = A(J)
- 160 LET A(J) = A(I)
- 170 LET A(I) = Q
- 180 NEXT J
- 185 PRINT
- 190 PRINT A(I)
- 200 NEXT I
- 210 DATA 6,8,12,20,12,12,15,14,24,28,40,3,11,2.5,3,5
- 211 DATA 9.8,3.4,7.5
- 220 END

*Result*:

ALTITUDE | UPPER BASE | LOWER BASE | AREA |

8 | 12 | 20 | 128 |

12 | 12 | 15 | 162 |

14 | 24 | 28 | 364 |

40 | 3 | 11 | 280 |

2.5 | 3 | 5 | 10 |

9.8 | 3.4 | 7.5 | 53.41 |

10

53.41 | (Note: The actual computer printout |

128 | skips a line between each value at |

162 | the left.) |

36

###
*
Explanation of Program
*
8:

Lines 120 instruct the computer to compare in order 130 the value of each area with the value of 140 every other area that follows it. If the first number is less than the second of the two numbers being compared, the order remains the same. If the first number is greater than the second, proceed to line 150 to begin the process of reversing the position of the numbers. Line 150 assigns the value of the second number A(J) to a new variable Q. Line 160 assigns the value of the first number A(I) to the second number A(J). Line 170 assigns of A(J), to the first number A(I). Now A(I) and A(J) have been rearranged in ascending order of their values. Line 180 tells the computer to move on to the next comparison. Line 190 instructs the computer to print the numbers in order from smallest to largest.