Question: Write a program that accepts time in the format "hours:minutes" in String Format. Accepts hours between 1 to 12 (both inclusive) and seconds between 0 to 59 (both inclusive) and prints out the time they represent in words.
In this post, I will share the JAVA program to display time in words.
Sample Input and Output:
Input 1:
Enter Time-> 3:0
Output 1:
Three O' Clock
Input 2:
Enter Time-> 7:29
Enter Time-> 7:29
Output 2:
Twenty Nine minutes past Seven
Input 3:
Enter Time-> 6:34Output 3:
Enter Time-> 6:34
Output 3:
Twenty Six minutes to Seven
Twenty Six minutes to Seven
Input 4:
Input 4:
Enter Time-> 12:1Output 4:
Enter Time-> 12:1
Output 4:
One minutes past Twelve
One minutes past Twelve
Input 5:
Input 5:
Enter Time-> 12:45
Enter Time-> 12:45
Output 5:
Quarter to One
Quarter to One
Code:
Output Window:
If you have any doubts/questions related to Program, or if you want to give any suggestions, or want an explanation of code, feel free to comment below. I hope that my code is understandable. Please Subscribe to Programming Chaska for the latest programming updates and also to inspire me to write such unique and different programs.
Thank You for Visiting 😄
If you have any doubts/questions related to Program, or if you want to give any suggestions, or want an explanation of code, feel free to comment below. I hope that my code is understandable. Please Subscribe to Programming Chaska for the latest programming updates and also to inspire me to write such unique and different programs.
Thank You for Visiting 😄
Thank You for Visiting 😄
0 Comments