Question:
Create a Java program that simulates Digital Clock.?
2010-12-05 10:27:25 UTC
Create a Java program that simulates a live digital clock (NOT analog and NOT a combination). You may refer to chapters 13 – 15 in your book for the analog clock the author has created and use that code for reference. Your clock must be digital and be live (ticking). The clock must work stand-alone as well as in a web pagee (refer to chapter 17 for applets). You must also create a simple web page that will host the clock. The clock will display the time in this format: 10:32:44 PM presuming it is 10:32:44 PM. If the time has a single digit in the minutes or the seconds positions, they need to be prefixed with a 0 such as 12:04:08 AM. If it is the hour that is single, it should be left as a single digit such as 2:09:45 PM. I must be able to open theweb pagee with a browser and see the clock working. I also must be able to run the class file and see the clock working stand-alone using the java Clock command.

Please help me!!!
Three answers:
?
2010-12-05 10:29:45 UTC
This is a homework assignment. You post your code and questions/problems, we help you figure it out then.
sonia
2016-06-02 02:33:32 UTC
public static void main(String[] args){ if(Math.random() > 0.5) System.out.println("You won the game of darts!"); else System.out.println("You lost the game of darts!"); }
2010-12-07 14:11:50 UTC
to get the current time i think you do



String s=String.Format("%tT",Calendar.getInstance());

System.out.println(s);


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...