I have a simple task that should be relatively easy to implement by means of code. Your goal is to write a program that will output the time written in Spanish, given the time in HH:MM format. Many people likely don't know how to do this, so I will elaborate.
Time in Spanish is fairly logical. It usually follows the pattern of "Es la/Son las (hour) y (minutes)." Hours are in a 12-hour format, and "Es la" is only used if the hour is 1 (i.e. one o'clock). The minutes are a different story. If the minute is less than 30, then it is represented as shown above. If the minute is over 30, however, then the hour is rounded up and the minute is subtracted. For example, 7:35 is translated to the equivalent of "8 hours minus 25 minutes." Some more examples will be given below. The list of Spanish numbers that are necessary can be found here. There are accents on some numbers, but these are not necessary.
Note: The source says "uno," but to be grammatically correct it should be "una." This shouldn't affect any answers so far.
Note 2: Also, "cero" is not necessary. If your program outputs "Es la una" or "Son las tres," that is fine with me. Sorry for these rule changes.
- Input will be provided through STDIN or the equivalent in your language.
- No reading from outside libraries.
- Your code can do anything with invalid input.
- -10 if your code adds these extra phrases - "y cuarto" for :15, "y media" for :30, and "menos cuarto" for :45 (rounded up).
- -15 if your code can handle A.M. and P.M., responding with "de la mañana" and "de la tarde," accordingly.
- -15 if your code can translate the current time if no input is provided.
- This is a code-golf challenge, and it will be scored by bytes, not characters.
Son las ocho y diez.
Son las siete menos quince (or cuarto).
Es la una y veintinueve.
Es la una menos cinco.
Let me know if there is anything to specify here. This is my first question, so it is definitely not perfect.