Serge Krul - Happy Birthday! :)
by igalst
JavaScript
// Define constants
var LIMIT = 120;
// Define Class
var Person = function(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
};
Person.prototype.iterate = function(length, iteration){
for (var i = 0; i < length; i++) {
iteration.call(this);
}
};
Person.prototype.setHappiness = function(){
// TODO
};
Person.prototype.getHappiness = function(){
// TODO
};
Person.prototype.setSuccess = function(){
// TODO
};
Person.prototype.getSuccess = function(){
// TODO
};
Person.prototype.setHealth = function(){
// TODO
};
Person.prototype.getHealth = function(){
// TODO
};
Person.prototype.setPlans = function(){
// TODO
};
Person.prototype.processPlans = function(){
// TODO
};
// Utilities implementation
var Utilites = {
generatePlans: function(){
return "MAGIC";
}
};
/** Create a person and set his/her life */
var serge = new Person("Serge", "Krul");
serge.iterate(LIMIT, function(){
this.setHappiness(Math.pow(this.getHappiness()));
this.setSuccess(this.getSuccess() * 2);
this.setHealth(this.getHealth()+ 1);
this.setPlans(Utilites.generatePlans());
this.processPlans();
});