Skip to content

Instantly share code, notes, and snippets.

@thetekst
Created October 20, 2011 20:07
Show Gist options
  • Save thetekst/1302184 to your computer and use it in GitHub Desktop.
Save thetekst/1302184 to your computer and use it in GitHub Desktop.
AlligatorTest
package ru.thetekst.crocodile;
public class TestCrocodile {
public static void main(String[] args) throws InterruptedException {
Crocodile crocodile = new Crocodile();
System.out.println(crocodile.getState());
do{
Thread.sleep(1000);
System.out.println(crocodile.getState());
}while(crocodile.getWeight()<100);
crocodile.kill();
System.out.println(crocodile.getState());
}
}
/*
Input:
Крокодил жив, имеет вес: 20.0
Крокодил жив, имеет вес: 40.0
Крокодил жив, имеет вес: 60.0
Крокодил жив, имеет вес: 80.0
Крокодил жив, имеет вес: 100.0
Крокодил мёртв
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment