佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 914|回复: 2

java programming高手请进来帮帮我!!

[复制链接]
发表于 28-1-2007 09:42 AM | 显示全部楼层 |阅读模式
请教教我如何做这题,要用什么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 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 28-1-2007 11:52 PM | 显示全部楼层
学校的功课post 上来并不太好吧 。。。 try this:

SimpleDateFormat dateformat = new SimpleDateFormat("HH:mm:ss"; 但是要配合一些 programming logic 的。 
回复

使用道具 举报

发表于 30-1-2007 01:25 AM | 显示全部楼层
你不妨先试试自己写? 有问题的话再放上来好了.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 18-5-2024 11:41 PM , Processed in 0.064103 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表