21 lines
328 B
Text
21 lines
328 B
Text
|
|
class Cake{
|
|
init(goodness){
|
|
this.adjective = this.rate(goodness);
|
|
}
|
|
rate(goodness){
|
|
if(goodness)
|
|
return "delicious";
|
|
else
|
|
return "horrendous";
|
|
}
|
|
taste(){
|
|
print "The " + this.flavor + " cake is " + this.adjective + "!";
|
|
}
|
|
}
|
|
|
|
var cake = Cake(true);
|
|
cake.flavor = "German chocolate";
|
|
var t = cake.taste;
|
|
t();
|
|
|