Assignments: Students with odd number în the group catalog are

advertisement
Assignments: Students with odd number în the group catalog are assigned problem 1, those
with even number – problem 2.
1. Use the B method to specify a system capable of handling invoices for customers in a
commercial environment. The system has to manage the following entities: client, product, invoice
and line of invoice. Next, there is a brief description of each of them:
• A client is recorded in the system together with its category (normal, dubious or friend) and
also with its maximum allowance, which is a certain amount of money that cannot be
exceeded in any invoice issued to that client. To each category of clients there corresponds a
certain discount applicable to the corresponding invoices.
• A product is recorded together with its price, its status (available or sold out) and its
possible substitute (if any), which is another product guaranteed not to be itself sold out.
• An invoice is first concerned with the client to whom it is issued. An invoice also has a
discount reperesented by a certain percentage to be applied to the total of the invoice.
Finally, an invoice is characterized by the maximum amount of money that is allowed to it.
These two attributes of an invoice (percentage and amount allowed) are taken originally
(when the invoice is created) from similar attributes of the client (discount and allowance).
• Each line of an invoice is concerned with a certain article, the quantity of that article, and its
unit cost. This last attribute of an invoice is taken originally (when the invoice is created)
from the price attribute of the article.
The system should provide a number of operations for creating and modifying a client, for creating
and modifying a product, for creating and distroying an invoice, and, finally, for adding a new line
to an invoice. Next, there are a number of informally stated laws that the system should satisfy:
1. A sold out product cannot be part of an invoice.
2. However, if there is a substitute for the sold out product, then the system must automatically
replace, in the invoice, the product in question with the substitute.
3. No two distinct lines of the same invoice may correspond to the same article.
4. No invoice should be made for dubious clients.
5. The (discounted) total of an invoice must not be greater than the maximum amount of
money allowed for that invoice.
6. Friend clients get a 20% discount, whereas other clients get no discount at all.
The specification should be realized and verified for consistency within AtelierB. All components
must pass type-checking and PO's generation. The PO's not automatically proven should be
manually analyzed for validity (informal proof/reasoning în a separate file attached to the B
project).
2. Use the B method to specify a system capable of handling student catalogs în an academic
environment. The system has to manage the following entities: lecture, sudent, catalog and item
(line) of catalog. Next, there is a brief description of each of them:
• A lecture is recorded in the system together with its code (a unique identifier for the lecture),
its name, number of credits, semester and a possible curriculum prerequisite (another
lecture, that must be taken în order to be allowed to attend the current one).
• A student is recorded together with its unique id, its name and group.
• A catalog is first concerned with the lecture to which it belongs. A catalog also has a group
for which it is created, as well as a type (normal or re-examination).
• Each catalog item is concerned with a certain student, a status (present or absent) of this
student at the corresponding lecture examination, and the obtained mark.
The system should provide a number of operations for creating and modifying a lecture, for creating
and modifying a student, for creating and distroying a catalog, and, finally, for adding a new line to
a catalog. Next, there are a number of informally stated laws that the system should satisfy:
1. Within the catalog corresponding to a particular group there are only items referring to
students belonging to the group în question.
2. No two distinct items of the same catalog may correspond to the same student.
3. Only students that were present at an exam may have a mark recorded în the corresponding
catalog.
4. A student is allowed to participate în the examination session for a lecture (and obtain a
mark) only if he has passed (mark at least 5) the exam of the corresponding curriculum
prerequisite (if any).
5. The semester of a lecture is always greater then the one of its prerequisite (if any).
The specification should be realized and verified for consistency within AtelierB. All components
must pass type-checking and PO's generation. The PO's not automatically proven should be
manually analyzed for validity (informal proof/reasoning în a separate file attached to the B
project).
Download