When should such a constraint be imposed?



Task 1



Modules can be taken if they have more than

seven students registered

The assessments for a module must total

100%

Students must register for 120 credits each

year

Students must take at least 90 credits of CS

modules each year

All modules must have at least one

assessment worth over 50%

Students can only have assessments for

modules which they are taking


Task 1a)
Modules can be taken if they have more than
seven students registered
context Module
invariant: taken_by?size > 7

Task 1b)
The assessments for a module must total 100%
context Module
invariant:
set_work.weight?sum( ) = 100

Task 1c)
Students must register for 120 credits each year
context Student
invariant: takes.credit?sum( ) = 120

Task 1d)
Students must take at least 90 credits of CS
modules each year
context Student
invariant:
takes ?
select(code.substring(1,2) = ‘CS’).credit?sum( ) >= 90

Task 1e)
All modules must have at least one assessment
worth over 50%
context Module
invariant: set_work?exists(weight > 50)

Task 1f)
Students can only have assessments for modules
which they are taking
context Student
invariant:
takes?includesAll(submits.for_module)

Computer Science & Information Technology

You might also like to view...

When a field is declared static there will be __________.

a. a copy of the field for each method in the class b. a copy of the field in each class object c. only one copy of the field in memory d. two reference copies of the field for each method in the class

Computer Science & Information Technology

Fill in the code to complete the following method for binary search.

``` public static int recursiveBinarySearch(int[] list, int key) { int low = 0; int high = list.length - 1; return __________________________; } public static int recursiveBinarySearch(int[] list, int key, int low, int high) { if (low > high) // The list has been exhausted without a match return -low - 1; // Return -insertion point - 1 int mid = (low + high) / 2; if (key < list[mid]) return recursiveBinarySearch(list, key, low, mid - 1); else if (key == list[mid]) return mid; else return recursiveBinarySearch(list, key, mid + 1, high); }``` a. recursiveBinarySearch(list, key) b. recursiveBinarySearch(list, key, low + 1, high - 1) c. recursiveBinarySearch(list, key, low - 1, high + 1) d. recursiveBinarySearch(list, key, low, high)

Computer Science & Information Technology

A DDR3 module transfers data at a clock rate of __________ Mbps.

A. 600 to 1200 B. 800 to 2133 C. 1000 to 2000 D. 1500 to 3000

Computer Science & Information Technology

Rather than returning a value, a method can signal its client by

a. Crashing the program b. Beeping c. Throwing an exception d. Ignoring the requested record

Computer Science & Information Technology