
XXXXX XXXXXXX XX XX XX XX XXXXXXX XXXXXXX XX XX XX XX XX XX XXXXXXX XXXXXYour task in this project is to develop a package that provides an operation to display one of these large digits at an arbitrary position on the screen. Here is the spec for this package (you can add the banner comment):
WITH Screen; PACKAGE Big_Digits IS SUBTYPE ADigit IS Natural RANGE 0..9; BadPosition: EXCEPTION; PROCEDURE DisplayDigit (Item: IN ADigit; Row: IN Screen.Depth; Column: IN Screen.Width); -- Pre: Digit, Row, and Column, are all defined -- Post: displays the given digit at the given position; -- raises BadPosition if the digit would go over the -- boundaries of the screen END Big_Digits;For example, a call
Big_Digits.DisplayDigit(Item => 8, Row => 10, Column => 25);
displays a large 8 whose upper-left corner (that is, the leftmost end of the blank row) is at row 10, column 25.
DigitColumns: CONSTANT Positive := 9; DigitRows : CONSTANT Positive := 12;
SUBTYPE DigitRow IS String (1..DigitColumns); -- one row of the digit TYPE BigDigit IS ARRAY (1..DigitRows) OF DigitRow; -- 12 rows TYPE DigitFont IS ARRAY(0..9) OF BigDigit;
AllTheDigits: DigitFont;
DigitFile: Ada.Text_IO.File_Type;The package body will also contain the body of DisplayDigit, and also an initialization part that will read the data file to initialize AllTheDigits, row by row for each digit. Note that you can read a row with an ordinary Ada.Text_IO.Get.
The procedure DisplayDigit just displays the digit row by row.
To implement your test plan for this project, you'll have to write your own test program that tests the behavior of the package and procedure.
The package spec (big_digits.ads) and data file (bigdigits.dat) for this project are online in the programs51 directory. Also online is a skeleton of the package body (big_digits.adb). Your tasks are to complete the package body and develop a test program.