Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Definition?

Could someone answer a Quick java question?

What would be the definition for a post-condition x=0 in this class. I need help with the last part of an assignment and I would much appreciate it. I assume it is: x = 0; but I think that is just too simple.

/*Class FirstMove

{
private int x;
private static int count;

public FirstMove()
{

}*/

Comments

  • sunlotussunlotus Posts: 55Member

    In computer programming, a postcondition is a condition or predicate that must always be true just after the execution of some section of code or after an operation in a formal specification. Postconditions are sometimes tested using assertions within the code itself.

    For example: The result of a factorial is always an integer and greater than or equal to 1. So a program that calculates the factorial of an input number would have postconditions that the result after the calculation be an integer and that it be greater than or equal to 1.

    Another example: a program that calculates the square root of an input number might have the postconditions that the result be a number and that its square be equal to the input. (Wikipedia)

Sign In or Register to comment.