@@ -8,21 +8,20 @@ Packages Lab
8
8
9
9
* Requirements
10
10
11
- - Create a program to add and remove integer values from a list
11
+ - Create a program to build a list of simple mathematical equations and then
12
+ print out if, for each equation in the list, the result would be in range
12
13
13
- - Program should allow user to do the following as many times as desired
14
-
15
- - Add an integer in a pre-defined range to the list
16
- - Remove all occurrences of an integer from the list
17
- - Print the values in the list
14
+ - Equations are two floating point numbers and a simple operation (+, -, *, /)
18
15
19
16
* Hints
20
17
21
- - Create (at least) three packages
18
+ - You should create the following packages
22
19
23
- 1. minimum/maximum integer values and maximum number of items in list
24
- 2. User input (ensure value is in range)
25
- 3. List Abstract Data Machine
20
+ - Types package that creates a numeric range, an equation record type, and
21
+ a mechanism to convert the record to a string
22
+ - Validation package to verify that the equation result would be in range
23
+ - List package to store the list of equations, and a mechanism to retrieve
24
+ each item in the list
26
25
27
26
- Remember: :code: `with package_name; ` gives access to :code: `package_name `
28
27
@@ -40,23 +39,21 @@ Creating Packages in :toolname:`GNAT Studio`
40
39
- Fill in name of Ada package
41
40
- Check the box if you want to create the package body in addition to the package spec
42
41
43
- -----------------------------------
44
- Packages Lab Solution - Constants
45
- -----------------------------------
46
-
47
- .. container :: source_include 100_packages/lab/packages/answer/constants.ads :code:Ada :number-lines:1
42
+ -------------------------------
43
+ Packages Lab Solution - Types
44
+ -------------------------------
48
45
49
- .. container :: speakernote
46
+ .. container :: source_include 100_packages/lab/packages/answer/types.ads :code:Ada :number-lines:1
50
47
51
- Could use functions where the value is stored in the body - less recompilation if the value changes (but then they cannot be universal integers)
48
+ .. container :: source_include 100_packages/lab/packages/answer/types.adb :code:Ada :number-lines:1
52
49
53
- ------------------------------
54
- Packages Lab Solution - Input
55
- ------------------------------
50
+ ------------------------------------
51
+ Packages Lab Solution - Validation
52
+ ------------------------------------
56
53
57
- .. container :: source_include 100_packages/lab/packages/answer/input .ads :code:Ada :number-lines:1
54
+ .. container :: source_include 100_packages/lab/packages/answer/validator .ads :code:Ada :number-lines:1
58
55
59
- .. container :: source_include 100_packages/lab/packages/answer/input .adb :code:Ada :number-lines:1
56
+ .. container :: source_include 100_packages/lab/packages/answer/validator .adb :code:Ada :number-lines:1
60
57
61
58
-----------------------------------
62
59
Packages Lab Solution - List
0 commit comments