2012-10-22T08:29:16-04:00
Write a program that allows you to display a number in Second, Display is equivalent in Hour: Minute: Second
1
2012-10-23T09:22:08-0400
import java.util.Scanner; public class q16978 { public static void main(String[] args) { System.out.print("Please input the number of seconds: "); Scanner in = new Scanner(System.in); int numOfSeconds = in.nextInt(); System.out.print(numOfSeconds + " seconds = "); int hours = numOfSeconds / 3600; numOfSeconds = numOfSeconds % 3600; int minutes = numOfSeconds / 60; numOfSeconds = numOfSeconds % 60; System.out.println(hours + " hours, " + minutes + " minutes, " + numOfSeconds + " seconds."); } }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
Java JSP JSF
Comments