Introduction




Document: Software Engineering 1: Lab Exercises

next Exercise 1: The sin() Function (20%)
up Session 7: Week 14/15: Functional Decomposition
gif Session 7: Week 14/15: Functional Decomposition

Introduction

This session is concerned with practical experimentation with the C facilities for breaking down a program into smaller, more manageable, pieces called functions.

The standard C library makes available a large range of standard mathematical functions. These include standard trigonometrical functions, sin(), cos() and tan(). These three functions each accept one argument (of floating_point_type) and return a result (also of floating_point_type). The argument must be an angle measured in radians. Often it is more convenient to work with angles measured in degrees instead. The ultimate objective of this session is for you to write your own trigonometric functions (exploiting the existing standard functions) which will accept arguments in degrees rather than radians. However, we shall get there through a series of smaller steps.

Before this session it is essential that you review and understand the very basic example programs, already introduced in the lectures, which illustrate functional decomposition. These are:

The session is divided into five separate exercises. Each of these builds on the previous one. It is important that you read through the instructions for all the exercises, in advance of the lab session. None of the exercises is very complex in itself, and you should be able to complete all five in the time available. However, it is more important to fully complete as many of the exercises as possible than to make an incomplete attempt at them all. So, it is essential that you take the exercises in the order given, and do not attempt to go on to a following exercise until you have fully completed its precursor.

Each exercise involves developing a program. Note carefully that "develop" here means writing, compiling (with no errors or warnings), and testing. The tests should exercise a reasonable range of behaviour before you consider them complete. The report must specify exactly (including actual numerical values, where relevant) what tests you carried out, what results you expected, and what results the program generated. If the actual results are not exactly the same as the results you expected, you must comment on this.




Document: Software Engineering 1: Lab Exercises

next Exercise 1: The sin() Function (20%)
up Session 7: Week 14/15: Functional Decomposition
gif Session 7: Week 14/15: Functional Decomposition



McMullin@eeng.dcu.ie
Tue Apr 30 14:15:37 GMT 1996