views:

95

answers:

3

Hi. Id like to make simple digital clock just from symbols. My idea was to make this template:

 {
        System.out.println(" _"); 
        System.out.println("|" + "_"+  "|");
        System.out.println("|" + "_" + "|");
      } 

 _ 
|_|
|_|
BUILD SUCCESSFUL (total time: 0 seconds)

 _      _
 _|  |   _|
|_   |   _|   ....etc

and then parse the symbols which corresponds with the number from input. I searched for some help with google but still lost as Im newbie in java. Any help appreciated.

A: 

You need to create 10 functions to print the numbers from 0 to 9. Where ever you need to print time send the time as string to a function which parse the string and for each number call the print functions defined.

Bhushan
Printing is (as so often) the easy part of the problem. The scanning is much harder - not least because you have to deal with erroneous inputs, and data spread over three lines.
Jonathan Leffler
Also, printing the number 1234567890 isn't trivial with your 10 functions - unless you design them to print 'line 1' then 'line 2' then 'line 3' based on (probably) an argument. If you're not careful you get a staircase of numbers descending down and across the page.
Jonathan Leffler
+1  A: 

Borrow some unreadable code from this thread.

mobrule
A: 

Thak you for tips. I need push forward a litte :)

I made a sample of three numbers in 2-dim array.
Now I'd like to display certain number depending on users input.
The number is made from rows.
So if the user want number 1 in "ascii art" then these elements should print out array[0][0] + array[0][1] + array[0][2].
If it would be two then same approach is used. So my question is how to make a for loops to take out elements and display them to the console. At the End it should be a clock which dispay eg. 15:34 in the way I described. Here is code: pastebin.com/m18f93293

(Im sorry it does not show right if I use code sample here).

I also tried make a preview of what Bhushan wrote http://pastebin.com/m190f9d11 But it seems to be a bad way. Because I would have to use 4 time switch statement for all 10 numbers. If someone have better idea, Id be happy.

Thanks in advance !

Tali