
The purpose of this lab exercise is to get some practice writing functions and putting them in packages. Your task is to modify the package Min_Max and test the modified package. The modified specification will look like:
PACKAGE Min_Max IS ---------------------------------------------------------------- --| specifications of functions provided by Min_Max package --| Author: Michael Feldman, The George Washington University --| Last Modified: February 1999 ---------------------------------------------------------------- FUNCTION Minimum (Value1, Value2: Integer) RETURN Integer; -- Pre: Value1 and Value2 have been assigned values -- Post: Returns the smaller of the two input values FUNCTION Maximum (Value1, Value2: Integer) RETURN Integer; -- Pre: Value1 and Value2 have been assigned values -- Post: Returns the larger of the two input values FUNCTION Minimum (Value1, Value2: Float) RETURN Float; -- Pre: Value1 and Value2 have been assigned values -- Post: Returns the smaller of the two input values FUNCTION Maximum (Value1, Value2: Float) RETURN Float; -- Pre: Value1 and Value2 have been assigned values -- Post: Returns the larger of the two input values END Min_Max;
In the lab, modify the body of this package by adding function bodies for the two Float functions, then write a test program that shows that all four functions behave properly. Adding the additional functions is an example of overloading, which is a programming language facility that allows several functions (or procedures) to have the same name, provided that they have different parameter profiles.