Lecture 9

 

There will be additional more basic Ada texts on reserve in the CISAT library

 

Discussed first program which used stacks with array implementation and integers – viewed Ana Stanescu’s code

          Talked about the need for additional comments explaining language syntax

          Talked about only accessing stack using procedures and functions in the package

          Introduce test program to user (include put statements telling what program will do)

          Include put statements describing what you are testing and how you are getting your results (as we illustrated in class)

          Include an ending put statement telling that the program has ended normally

 

Discussed how you could fill a stack using a loop

Discussed how you could empty a stack using a loop

Discussed that when you empty it you lose the data on it which you might not want to do

Discussed how to create a second stack as the empty the first one – and that the second stack is in reversed order

Discussed how to restore the first stack to its original state by emptying the second one into it.

 

Naming conventions for code are shown below. 

Since the different package specs and bodies have the same names I suggest that you have each program’s components in a separate directory on your hard drive (or where ever you keep the code)

 

          adamsStack.adb – integer stack body  - 

          adamsStack.ads – integer stack specification

          adams8.adb  - test program for integers

          adams8out.txt   - for sample output produced by test program

 

                   can be submitted to the Digital Dropbox by midnight tonight September 26th for grading

          adamsStack.ads – float stack specification  - make sure that you don’t access the ARRAY or the TOP directly

          adamsStack.adb – float stack body

          adams9.adb – test program for floats

          adams9out.txt – for sample output produced by test program

                  

                   due Thursday – September 28th by the start of class

          adamsStack.ads – either integer or float specification WITH exceptions  - you don’t NEED to alter both

          adamsStack.adb – either integer or float body WITH exceptions

          adams10.adb – test program for integer or float WITH exception handling

          adams10out.txt – for sample output produced by test program

         

Please zip your files for each program together using zip (not rar) and submit them using the Digital Drop box

 

Here are the notes for Ada Exceptions.

 

Additional notes from class provided courtesy of Brent Kohler.