|
请教教我如何做这题,要用什么code?
Write a program time.java that accepts as input three integers representing the hours, minutes and seconds. Your program will then convert the time to its equivalent canonical form. To keep things simple, you may assume that each set of input is always expressible as a canonical time within a day, i.e. the canonical time computed will be in the range from 00:00:00 to 23:59:59. As such an input of say, 23 hours 59 minutes 60 seconds need not be accounted for. The following time.java program has been provided for you that reads in the three user input. Your task is to simply extend the program to compute and print out the canonical time as ouput.
A sample run of the program is shown below. User input is denoted in bold. Enter hours: 1Enter minutes: 1Enter seconds: 1The canonical time is 1 : 1 : 1 | Enter hours: 0Enter minutes: 0Enter seconds: 61The canonical time is 0 : 1 : 1 | Enter hours: 0Enter minutes: 0Enter seconds: 9999The canonical time is 2 : 46 : 39 | Enter hours: 10Enter minutes: 100Enter seconds: 1000The canonical time is 11 : 56 : 40 | Enter hours: 23Enter minutes: 58Enter seconds: 119The canonical time is 23 : 59 : 59 |
[ 本帖最后由 h@RT3r 于 28-1-2007 09:47 AM 编辑 ] |
|