CSC 234 Introduction to Packages: Creating a Math Utility ...
CSC 245 Introduction to Packages: Creating a Math Utility Library Lab 1
In this laboratory exercise you will learn about packages in Ada as you build a library of math utilities. This package will be modified and used on occasion during this course, so be sure to keep a copy of your source code. Each team is responsible for designing and implementing their own version of this package.
Define: The first step in the software development lifecycle is to determine what problem is being solved. In this case we are building a library of computer math utilities. We will be adding features to this package later, but for now we will concentrate on base and string-to-number conversions. Specifically we will build functions and procedures to recognize integers and floats, and to convert between bases 2, 8, 10 and 16.
Design: The next step is problem decomposition and functional design. Layout the equations-in-order-of-solution (EIOS) for each routine listed below.
str_to_num - converts a string input into its equivalent integer or floating-point value.
num_to_str - converts an integer or float value into its equivalent string representation.
is_num - a Boolean function which returns true if its string argument represents a number.
base_convert - converts a number from one base to another (string representations OK).
As part of the design process you need to divide the work load among the team members. Don't forget that you will need to build a test program to verify/validate your package. So be sure to determine verification and validation test sets to be used during testing.
Verification/Validation Test Set
|Routine being tested |Test description |Test input value |Expected result |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
Complete your software design before attempting to write any code. You may wish to refer to the program base_changer.adb available on the academic Web Page.
Encode/Debug: The actual source code for your package should be constructed using the guidelines provided below:
(1) Implement and compile the package specification math_teamname.ads. Your version of this package may be different than the example.
package math_teamname is
subtype numstring is string(1..20);
function str_to_num(str:numstring)return integer;
function str_to_num(str:numstring)return float;
function num_to_str(num:integer)return numstring;
function num_to_str(x:float)return numstring;
function is_int(str:string)return Boolean;
function is_flt(str:string)return Boolean;
procedure base_convert(str: in out numstring; from,to: in integer);
end math_teamname;
(2) Implement and compile the package body math_teamname.adb. Be sure that the functions and procedures appearing in your package body are in the same order as they appear in YOUR package specification.
package body math_teamname is
function str_to_num(str:numstring)return integer is
:
end math_teamname;
(3) Implement and build a test program that allows you to verify that your functions and procedures are working as designed and that allows you to validate that your implemented design is producing correct results.
with ada.text_io, ada.integer_text_io, ada.float_text_io, math_teamname;
use ada.text_io, ada.integer_text_io, ada.float_text_io, math_teamname;
procedure test_math is
:
begin
:
end test_math;
Verify/Validate: Verify design and validate outputs for the routines in your package. Make a note of any errors encountered and the corrections needed.
Error/Correction Log
| |
| |
| |
| |
| |
| |
Each team should submit a copy of the source code for the package specification, package body and test program. Each team member should provide a brief summary of their responsibilities in this project. All materials due in class on Wednesday Jan 27th.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- steps to creating a business plan
- introduction to a research paper example
- steps to creating a business
- creating a one to many relationship access
- introduction to a biography essay
- creating a thesis for a research paper
- creating a website to make money
- introduction to computer packages pdf
- student introduction to a class
- a programmer s introduction to mathematics
- introduction to math montessori
- creating a how to guide