public class MuieGO3 {
private static final String[] oreJmekere = { "", " ten", " twenty", " thirty", " forty", " fifty", " sixty",
" seventy", " eighty", " ninety" };
static final String[] minuteJmekere = { "", " one", " two", " three", " four", " five", " six", " seven", " eight",
" nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen",
" eighteen", " nineteen" };
public static void main(String[] args) {
System.out.println(ceasCuCuc(2,01));
System.out.println(ceasCuCuc(2,10));
System.out.println(ceasCuCuc(2,15));
System.out.println(ceasCuCuc(2,28));
System.out.println(ceasCuCuc(2,30));
System.out.println(ceasCuCuc(2,40));
System.out.println(ceasCuCuc(2,45));
System.out.println(ceasCuCuc(2,47));
}
static String ceasCuCuc(int ora, int minute) {
String oraText = "";
if (minute == 0) {
oraText = minuteJmekere[ora] + " o' clock";
} else if (minute == 15) {
oraText = " quarter past" + minuteJmekere[ora];
} else if (minute < 30) {
if (minute < 20) {
oraText += minuteJmekere[minute];
} else {
oraText += oreJmekere[minute / 10];
oraText += minuteJmekere[minute % 10];
}
oraText += " minutes past" + minuteJmekere[ora];
} else if (minute == 30) {
oraText += " half past" + minuteJmekere[ora];
} else if (minute == 45) {
oraText += " quarter to" + minuteJmekere[ora + 1];
} else if (minute > 30) {
if ((60 - minute) < 20) {
oraText += minuteJmekere[60 - minute];
} else {
oraText += oreJmekere[(60 - minute) / 10];
oraText += minuteJmekere[(60 - minute) % 10];
}
oraText += " minutes to " + minuteJmekere[ora + 1];
}
if(minute==1 || minute == 59){
oraText=oraText.replace("minutes", "minute");
}
return oraText.trim();
}
}