Question: Question 1 - 5marks each Instruction 2 Question 1 Question 2 Question 3 Question 4 Question 5 Consider a pharmacy shop, a supper market, a













Question 1 - 5marks each Instruction 2 Question 1 Question 2 Question 3 Question 4 Question 5 Consider a pharmacy shop, a supper market, a gas filling station, a clinic, a church, and a retail shop and generate an informal requirement for each of these institutions. Question 6 Question 7 Question 8 Question 9 Question 10 Question 2 - 5marks Instruction Question 1 3 Question 2 Question 3 Question 4 Question 5 Suppose Nice Girl is the set of all nice girls, Sailor is the set of all sailors, and loves is a relation between nice girls and sailors such that n loves s means that nice girls n loves sailor s. Make precise the sentence "All the nice girls love a sailor" to expose at least two distinct meanings of this ambiguous utterance. Question 6 Question 7 Question 8 Question 9 Question 10 Question 3 - 2marks each Instruction Question 1 Question 2 Question 3 Suppose Man and Occasion are types for men and occasions and suppose that D: Man H Occasion is a relation between men and occasions recording the occasions on which the men were deceivers. Formalize the statement "Men were deceivers ever": 1. as an equality between sets Question 4 Question 5 Question 6 Question 7 Question 8 2. and as universal quantification Question 9 Question 10 3. Write down also the negation of the universal quantification, expressing it as an existential quantification. Question 4 - 30marks Instruction Question 1 Question 2 Question 3 Question 4 Question 5 Question 6 The table below gives the informal requirements for phase 3 of the library management system, in which reservation of titles by borrowers is to be supported. Inputs Processing Outputs Delete a book book If the title of this book has been reserved response by a borrower then the response is Borrowers waiting', and the book is not removed from the library system. Delete a borrower person Any reservations made by this borrower response are cancelled. Lend a book book, If the book is a reserved title, and this bor- response person rower is not the first borrower waiting for this title, then the response is Book reserved'. Question 7 Question 8 Question 9 Question 10 00 Question 4 Cont'd 9 Return a book CSCD 419 - Semester Assignment book response Instruction If the book is a title that has borrowers waiting, and there are fewer instances of this title waiting for their borrowers than there are borrowers, then the response is 'Book reserved'. Question 1 Question 2 Question 3 Reserve a title 6 Question 4 Question 5 response title, person Question 6 Question 7 Question 8 Question 9 If the title is not one owned by the library, then the response is 'Title not available'. If the person is not a borrower, then the response is 'Not a borrower'. If this bor- rower already has a reservation for this title, then the response is Book already reserved by this borrower'. Otherwise the title is reserved to the borrower, and the response is Book reserved'. Question 10 Write a specification of phase 3 of the library management system reusing as much as possible of the phase 2 specification. Question 5 - 40marks Instruction Question 1 Question 2 Question 3 Question 4 7 Question 5 Question 6 Question 7 The informal descriptions of the operations of the banking system is shown in the table below. Formalize it using the methods taught under schemas and specifications. Inputs Processing Outputs Open a deposit account amount If there are no account numbers left, then response, the response is 'No more account account numbers'. If the amount offered is nega- number tive, then the response is 'Overdrawn bal- ances are not allowed in deposit accounts'. Otherwise the account is opened in the input amount with an unused account number chosen by the system, and the response is 'Account opened'. The account number chosen is displayed. Open a current account amount If there are no account numbers left, then response, the response is 'No more account account numbers'. Otherwise the account is opened number in the input amount with an unused account number chosen by the system, and the response is Account opened'. The account number chosen is displayed. Question 8 Question 9 Question 10 Question 5 Cont'd Instruction Question 1 Close an account Question 2 Question 3 account number response, amount Question 4 Question 5 Question 6 Question 7 If the account number is not active, then the response is 'Not an active account number'. If the account number is active, but is a current account that is overdrawn, then the response is Deposit the stated amount to clear', and the output amount is the amount to be paid in to clear the account. Otherwise the account is removed from the records, the closing balance is output, and the response is 'Account closed'. Question 8 Question 9 Question 10 Question 5 Cont'd Instruction Question 1 Question 2 response, amount Question 3 Question 4 9 Question 5 Question 6 Make a deposit or a withdrawal account If the account number is not active, then number, the response is 'Not an active account amount number'. If the account is a deposit account that would become overdrawn, the response is 'Overdrawn balance not allowed', and an output amount is given to show the current balance of the account. Otherwise the balance of the account is changed according to the amount, positive amounts representing deposits, and nega- tive amounts representing withdrawals, and the response is 'Transaction complete'. Question 7 Question 8 Question 9 Question 10 Question 6 - 5marks each Instruction Question 1 Question 2 Question 3 Question 4 Modify your specification from Question 5 in the light of a new requirement, changing the response to making a deposit or a withdrawal as follows: 1. If the amount was positive, the response is to be "Deposit completed" Question 5 10 Question 6 Question 7 Question 8 Question 9 2. If the amount was negative, the response is to be "Withdrawal completed" Question 10 Question 7 - 5marks Instruction Question 1 Question 2 Question 3 Question 4 Question 5 Define the set of all palindromes of values of a given type. (A sequence is a palindrome if it is the same backwards as forwards) Question 6 11 Question 7 Question 8 Question 9 Question 10 Question 8 - 5marks each Instruction Question 1 Question 2 Question 3 Question 4 A function min takes two integers as arguments and has the smaller of them for its value. 1. Write an axiomatic description of this function Question 5 Question 6 Question 7 12 Question 8 2. Write also a syntactic equivalence that would declare the same function Question 9 Question 10 Question 9 - 2marks each Instruction Question 1 Question 2 Question 3 In a banking system, the balance in each account is recorded by a partial function balance: AcctNo Z where integers are used to record sums of money. If acno : AcctNo is in the domain of balance, say what the type is of each of the following terms. 1. acno H 5000 Question 4 Question 5 Question 6 Question 7 Question 8 13 Question 9 2. balance acno Question 10 3. dom balance 4. ran balance Question 10 - 5marks each Instruction Question 1 1. From Question 9, write down a predicate to formalize the statement "the active accounts are those for which there are balances" Question 2 Question 3 Question 4 Question 5 2. Write down a predicate to formalize the statement "overdrawn accounts are those accounts that have negative balances" Question 6 Question 7 Question 8 Question 9 3. Write down an expression for the set of account numbers of deposit accounts with balances exceeding 500000 14 Question 10 4. If c: Customer is a particular customer, write down an expression for the account numbers associated with c
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
