Homework 2: Ibrahim Maymoon 442101552

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Homework 2

Ibrahim Maymoon
442101552
Q1)
1. context department inv :
Self.nbrEmployees include(self.manages)

2. context department inv :


Self.nbrEmployees = implies self.manges size() < 2

3. context project inv :


Self.controls.nbrEmployees size() >= 5

4. context Employee inv :


Self.leave.workFor.controls size() >= 1

5. context project inv :


Self.Location size() = 1

6. post :
Self.worksFor = self.workFor@pre including(e)
Q2)
1. [ITEM,CATEGORIES,CLIENTS ]
Bills
client: P CLIENTS
category: CLINTS P CATEGORIES
item :CLINTS P ITEM
Bill: CATEGORIES ITEM

Item = dom category


category = dom Bill
{x€Bill |category(x)= }
{ x€Bill | item(x)=. }
2)
CreateBill
Bills
c? : CLIENTS
T? : CATEGORIES
i? : ITEM
c? client
T? =
I? =
Bill' = Bill {T? i? }

AddItemToBill
Bills
c? : CLIENTS
i? : ITEM
c? € client
item' = item {c? I? }
GetItemsOfGivenCategory
Bills
c! : CLIENTS
T!: CATEGORIES
i? : ITEM
i? = Bill(T?)

ContainSameItem
Bills
c? : CLIENTS
i? : ITEM
c? € Bill(i?)

You might also like