Docsity

Ada95 Package for Circular Type: Successor and Predecessor Functions, Exercises of Computer Engineering and Programming

Toggle sidebar
bg1
Problem C9. (Unified Computers and programming)
1. Write a simple package that contains
a. A type definition
b. Two functions called Successor and Predecessor that work exactly like
Type’Succ and Type’Pred. The only difference being:
i. Successor(Type’Last) = Type’First
ii. Predecessor(Type’First) = Type’Last
For example:
type Day is (Monday, Tuesday, Wednesday, Thursday,
Friday, Saturday, Sunday);
Successor(Sunday) = Monday
Predecessor(Monday) = Sunday
Turn in a hard copy of your algorithm and code listing (package specification and
package body), and an electronic copy of your code.
2. Write an Ada95 program that demonstrates the functionality of your package
from question 1 above. Turn a hard copy of your code listing and an electronic
copy of your code.
docsity.com

Partial preview of the text

Download Ada95 Package for Circular Type: Successor and Predecessor Functions and more Exercises Computer Engineering and Programming in PDF only on Docsity!

Problem C9. (Unified Computers and programming)

  1. Write a simple package that contains a. A type definition b. Two functions called Successor and Predecessor that work exactly like Type’Succ and Type’Pred. The only difference being: i. Successor(Type’Last) = Type’First ii. Predecessor(Type’First) = Type’Last

For example:

type Day is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday) ;

Successor(Sunday) = Monday Predecessor(Monday) = Sunday

Turn in a hard copy of your algorithm and code listing (package specification and package body), and an electronic copy of your code.

  1. Write an Ada95 program that demonstrates the functionality of your package from question 1 above. Turn a hard copy of your code listing and an electronic copy of your code.

docsity.com