文件名称:SSD3, PQ_1
-
所属分类:
- 标签属性:
- 上传时间:2013-02-04
-
文件大小:1.47kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
import java.io.*; import java.util.*; public class SecondsCalculator { private static BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); private static PrintWriter stdErr = new PrintWriter(System.err, true); private static PrintWriter stdOut = new PrintWriter(System.out, true); public static void main(String[] args) throws IOException { int myHour= 0, myMin= 0, mySec = 0; boolean justice = false; do { stdOut.print("time [hours:minutes:seconds]>"); stdOut.flush(); String myTime = stdIn.readLine(); StringTokenizer tknzr = new StringTokenizer(myTime, ":"); int num = tknzr.countTokens(); if(num != 3) { stdErr.print("Invalid input"); stdErr.flush(); stdErr.println(); continue; } else { myHour = Integer.parseInt(tknzr.nextToken()); myMin = Integer.parseInt(tknzr.nextToken()); mySec = Integer.parseInt(tknzr.nextToken()); if(myHour > -1 && myHour -1 && myMin -1 && mySec <60) justice = true; else { stdErr.println("Invalid input"); } } } while(!justice); stdOut.println("The number of seconds is: " + (myHour * 3600 + myMin * 60 + mySec)); } }
相关搜索: Practical Quiz 1
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : Practical Quiz 1.rar 列表 Practical Quiz 1/ICarnegieInfoApplication.java Practical Quiz 1/SecondsCalculator.java Practical Quiz 1
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.