-->
当前位置:首页 > 题库

PROGRAMMING:Time class

Luz5年前 (2021-05-10)题库647
Design a class called time. This class contains:
1. Data fields hour, minute and second representing time.
2. A nonparametric construction method to create a time object with the current time (the value of the data field represents the current time).
3. A method to construct a time object. This object has a specific time value. This value is expressed in milliseconds. The time period that has passed since midnight on January 1, 1970 (the value of the data field represents this time).
4. A method to construct time objects with specific hours, minutes and seconds.
5. Get methods of the three data fields hour, minute and second.
6. A method named setTime (long elapsetime) sets a new time for the object using the elapsed time. For example, if the elapsed time is 55550000 milliseconds, it is converted to 10 hours, 10 minutes, 10 seconds.
7. Write a test program, create two time objects (using new time() and new time (55550000)), and then display their hours, minutes and seconds
###Input format:
Input MS
###Output format:
Display by hour, minute and second
###Input example:
Here is a set of inputs. For example:
```in
five hundred and fifty-five million five hundred and fifty thousand
```
###Output example:
The corresponding output is given here. For example:
```out
Hour: 10 Minute: 19 Second: 10
```







answer:If there is no answer, please comment