### [2017-06-27] Challenge #321 [Easy] Talking Clock

JAVA without bonus

``````private static final String[] NUMBERS = {"twelve", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven"};
private static final String[] TENS = {"ten", "twenty", "thirty", "fourty", "fifty"};
private static final String[] ELEVENTWENTY = {"eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eightteen", "nineteen"};

public static void main(String[] args) throws IOException {

String[] parts = s.split(":");
int hours = Integer.parseInt(parts[0]);
int minutes = Integer.parseInt(parts[1]);
String result = "It's ";

boolean afternoon = false;
if (hours >= 12) {
hours -= 12;
afternoon = true;
}
result += NUMBERS[hours] + " ";

if (minutes < 11 || minutes > 19) {
if (minutes >= 10) {
result += TENS[minutes / 10 - 1] + " ";
}

if (minutes > 0 && minutes % 10 > 0) {
result += "oh ";
result += NUMBERS[minutes % 10];
}
} else {
result += ELEVENTWENTY[minutes - 11];
}

result += afternoon ? " pm" : " am";

System.out.println(result);
}
``````