Problem Statement
It was recently decided that time would be measured using a 10-based system. The length of a day remains the same, but it now contains 100 "new" hours (instead of 24 "old" hours). Each "new" hour contains 100 "new" minutes, and each "new" minute contains 100 "new" seconds. You must now write a program that converts "old" times into "new" times.
You will be given a String time containing a time written in the form "HH:MM:SS" (quotes for clarity), where HH, MM and SS are hours, minutes and seconds in the "old" time system. Return the same time in the same format, but in the "new" 10-based time system. Any fractional seconds should be omitted.
Definition
- Class:
- NewTimeSystem
- Method:
- convertFromOld
- Parameters:
- String
- Returns:
- String
- Method signature:
- String convertFromOld(String time)
- (be sure your method is public)
Constraints
- time will contain exactly 8 characters.
- time will be in the form âHH:MM:SSâ (quotes for clarity), where HH, MM and SS are two digit numbers.
- HH will be between 00 and 23, inclusive.
- MM and SS will be between 00 and 59, inclusive.
Examples
"00:00:00"
Returns: "00:00:00"
"00:00:02"
Returns: "00:00:23"
One "old" second is about 11.57 "new" seconds."23:55:30"
Returns: "99:68:75"
"14:34:12"
Returns: "60:70:83"