
Everything you need is in Chapters 1-7, and Section 11.2.
Background: In Project 4, you developed a package Date_Ops in which all your date validation and comparison was done "manually" with IF statements. As it happens, the standard library Ada.Calendar provides capabilities that make Date_Ops much simpler.
WITH Ada.Calendar; PACKAGE Date_Ops_2 IS ------------------------------------------------------------------------ --| Specification for package containing a few common date operations. --| Author: Michael B. Feldman, The George Washington University --| Last Modified: March 2001 ------------------------------------------------------------------------
FUNCTION IsValidDate (Month: Ada.Calendar.Month_Number; Day: Ada.Calendar.Day_Number; Year: Ada.Calendar.Year_Number) RETURN Boolean; -- Pre: Month, Day, and Year have well-defined values -- Post: returns True if the three parameters together -- form a valid date
FUNCTION IsEarlier (Month1: Ada.Calendar.Month_Number; Day1: Ada.Calendar.Day_Number; Year1: Ada.Calendar.Year_Number; Month2: Ada.Calendar.Month_Number; Day2: Ada.Calendar.Day_Number; Year2: Ada.Calendar.Year_Number) RETURN Boolean; -- Pre: All six parameters have well-defined values, and each of the -- two sets of parameters forms a valid date -- Post: returns True if the date formed by Month1, Day1, Year1 is -- earlier than the date formed by Month2, Day2, Year2, and -- False otherwise
PROCEDURE Get (Month: OUT Ada.Calendar.Month_Number; Day: OUT Ada.Calendar.Day_Number; Year: OUT Ada.Calendar.Year_Number); -- Pre: None -- Post: Prompt user for values and validate them; -- Month, Day, and Year together form a valid date
END Date_Ops_2;What to submit: See the document Preparation and Grading of Programming Projects for details. Your test plan and associated test program should include a proper set of tests for each of the two functions.