Write specifications using UML notation for a function that computes the sum of the first five positive integers in an array of n arbitrary integers.
What will be an ideal response?
```
The specifications include type definitions, arguments, and preconditions and postconditions.
// Computes the sum of the first 5 positive integers in an array anArray.
// Precondition: The array anArray contains n integers, n >= 5;
// at least 5 integers in anArray are positive.
// Postcondition: Returns the sum of the first 5 positive integers in
// anArray; anArray and n are unchanged.
sumOf(in anArray: arrayType, in n: integer): integer
Another solution:
// Computes the sum of the first 5 positive integers
// in an array anArray.
// Precondition: The array anArray contains n integers.
// Postcondition: If anArray contains at least 5 positive integers,
// returns their sum; otherwise, returns 0. anArray and n are unchanged.
sumOf(in anArray: arrayType, in n:integer): integer
```
You might also like to view...
Click the ____ check box in the warning dialog box if you don't want to be asked to confirm that you want to delete future layers.
A. No B. Confirmed C. Stop asking D. Don't show again
Match the following terms to their meanings:
I. Landscape A. Type of page orientation that is used for ordinary text II. Section break B. Part of a document that is formatted differently than the rest III. Portrait of the document IV. Section C. Used to divide a document into multiple segments V. Next page D. A type of page orientation sometimes used for charts E. A type of section break
Discuss the difference between population and sample data. Which one is used most often in statistics and why?
What will be an ideal response?
Which of the following is a type of database model in the Data Source Configuration Wizard?
A. Data Mart B. Entity Data Model C. Datawarehouse D. Datastore