Lecture 10 – held in 250 lab

 

We looked at an Ada program which tested the 6 relational operators and printed out the Boolean results.

We looked at Ada programs which illustrated the handling of pre-defined exceptions: constraint_error  and ada.text_io.data_error

We also looked at an Ada program which had a user-defined exception and exception handler.

Note: The links to these 3 files point to Word documents so when you save them you can’t directly load them into jGrasp.

 

Then we looked at how to output floating point numbers in non-exponential form.   testFloatOutput.

 

After class a student asked about a compile time error message they were getting which was generated bcause Ada doesn’t allow mixed mode arithmetic.  Here is come code which illustrates what that means and how to get around it.  testMixedMode

 

We spent the rest of the class discussing a QUEUE data structure.

We decided that we needed the operations (i.e. procedures and/or functions) to

          Make the queue empty     

          Test the queue for fullness

Test the queue for emptiness

Add something to the queue      ENQUEUE

Delete something from the queue    DEQUEUE

Look at the front (head) of the queue & perhaps look at the back (tail) of the queue

 

We need two indexes head and tail  (in the STACK we only needed one which we named top)

 

We then traced through an example showing what the results of each operation would be.

 

Your assignment for Tuesday, October 3rd is to write three (3) pieces of code

          A specification for a QUEUE

          An implementation for a QUEUE  - implemented as an array

          A test program  yourname11  to see that your specification and implementation work