Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Z Schemas Write the following operations using Z schemas. 1. Initialization operation InitState. Initialize stock, orders to empty sets and newids to Orderld set. NewOrder
Z Schemas
Write the following operations using Z schemas. 1. Initialization operation InitState. Initialize stock, orders to empty sets and newids to Orderld set. NewOrder Operation. This operation handles new orders. A new order leaves the stock unchanged but updates the orders and their status appropriately. A valid order identifier id! from the set newids is output by the operation. - Preconditions for NewOrder operation are: - An order? must be provided as an input Postconditions for NewOrder operation are: - A new order is added to the set of orders with order ID id! and products order? the status of the newly added order order? with order ID id! has to be pending The stock itself is unaffected by the operation above. - 2 CancelOrder Operation. Cancelling an order completely removes an existing order (determined by a valid order identifier input id?) from the system: CancelOrder leaves the stock unchanged but updates the orders and their status appropriately An input id? is required to specify which order is to be cancelled. This is the CancelOrder operation's precondition that must be satisfied for an order to be successfully invoiced: the status of the order to be cancelled is pending Postconditions for CancelOrder - The stock has not changed - The cancelled order is not in the set of orders (Hint: use operator) -The status of orders does not contain order id? (Hint: use operator ) operation are: 3. For error case CancelOrderError where the order state is not pending, assume the state is not to change. Return an error report message rep! "order not pending" 4. Specify total operation CancelOrderOp Write the following operations using Z schemas. 1. Initialization operation InitState. Initialize stock, orders to empty sets and newids to Orderld set. NewOrder Operation. This operation handles new orders. A new order leaves the stock unchanged but updates the orders and their status appropriately. A valid order identifier id! from the set newids is output by the operation. - Preconditions for NewOrder operation are: - An order? must be provided as an input Postconditions for NewOrder operation are: - A new order is added to the set of orders with order ID id! and products order? the status of the newly added order order? with order ID id! has to be pending The stock itself is unaffected by the operation above. - 2 CancelOrder Operation. Cancelling an order completely removes an existing order (determined by a valid order identifier input id?) from the system: CancelOrder leaves the stock unchanged but updates the orders and their status appropriately An input id? is required to specify which order is to be cancelled. This is the CancelOrder operation's precondition that must be satisfied for an order to be successfully invoiced: the status of the order to be cancelled is pending Postconditions for CancelOrder - The stock has not changed - The cancelled order is not in the set of orders (Hint: use operator) -The status of orders does not contain order id? (Hint: use operator ) operation are: 3. For error case CancelOrderError where the order state is not pending, assume the state is not to change. Return an error report message rep! "order not pending" 4. Specify total operation CancelOrderOpStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started