Alles Gute Fyx *knuddel*
Code:
import java.date.*;
import java.io.*;
class BirthdayGreeterWithNameAndDateFunctionality
implements SenselessGreeterInterface, Fancyness
{
public void greet(String name, Date birthday, Date today, Context ctx, IOStream out)
throws NoBirthdayError
{
if(birthday.day == today.day && birthday.month == today.month)
{
Language lang = ctx.getLanguage();
try
{
String message = lang.translate("Happy birthday %s!", name);
}
catch(TranslationError e)
{
try
{
out.write("Could not translate message");
}
catch(IOError e)
{
System.exit(1);
}
}
try
{
out.write(message);
}
catch(IOError e)
{
System.exit(1);
}
}
else
{
throw new NoBirthdayError(name, birthday, ctx);
}
}
public static void main(String[] args)
{
greeter = BirthdayGreeterWithNameAndDateFunctionality();
greeter.greet("DFYX", new Date(1988, 26, 8), date.today(), Context.factory(), IOStream.out);
}
}