Logout

4.1.12

Outline the pre- and post-conditions to a specified problem.

 

Teaching Note:

For example, cooking a dish for a meal.

All ingredients available before starting to cook.

A place to eat the food.


 

Sample Question:

sdfsdfsf

JSR Notes:

 

Teaching Note Example

Teaching Note:

For example, cooking a dish for a meal.

All ingredients available before starting to cook.

A place to eat the food.

So the point here is that it would be dumb to start cooking a dish for a meal if you didn't have the ingredients needed to make it, or if you didn't have a place to eat it after having made it. Much better to A. have pre-conditions, and B. check that those pre-conditions are met before launching in to the preparation of the meal.

 

Non-Computer Examples

IASAS Football Tournament:

Pre-conditions:

Referees selected, pay agreed upon, rules gone over. English an advantage.
Lines painted, and match-quality netting put on nets.
Schedule determined, based on seeding and arrival times, and trying to not have teams play first thing two days in a row.
Housing taken care of
etc.

Post-Conditions:

All teams play each other in round-robin.
Ties in round-robin result in 5 minute golden goal time, and if no winner, 1 point to each team.
Semi-finals and Finals played with golden goal and if needed penalties.
A IASAS champion crowned.

 

Computer/Programming/Java Examples

Binary Search of Strings

Pre-conditions:

A sorted array of Strings and key of type String sent as parameters.

Post-Conditions:

A key of type String is returned.
If there was more than one String of the same name, whichever one found first is sent.