Tutorial :How to read number and display it to unix console with pipe symbols



Question:

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.

Update:

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.


Solution:1

Borrow some unreadable code from this thread.


Solution:2

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »