Go to Top

Tuesday 1 November 2011

Utilities 19 : How to print in style with Java

Here's a nice program to print anything you want in style. Help yourself to the surprise.

Java Program :

import java.io.*;
import java.util.Random;
class visual
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
   static String s="",s1,a1="";
    static Random r=new Random();
 static void main()throws IOException
 {
     matrix("Welcome to the matrix");
     sleep(1000);
     input();
    }
    static void input()throws IOException
    {
        matrix("Enter any string : ");
        s=br.readLine();
        matrix(s);
    }
    static void matrix(String a)
    {
        int c,i,c1;
        for(c1=0;c1<a.length();c1++)
        {
            for(i=0;i<3;i++)
            {
            c=r.nextInt(123);
            if((c>=48 && c<=57) || (c>=65 && c<=90) || (c>=97 && c<=122))
            {
                System.out.print("\f"+a1+(char)c);
                sleep(70);
            }
            else{
                i=i-1;
               continue;
            }
        }
            a1=a1+a.charAt(c1);
            System.out.print("\f"+a1);
        }
        a1=a1+"\n\n";
 }
 static void sleep(int c)
 {
     try{Thread.sleep(c);}
     catch(Exception e){}
    }
}

Also, I am working on a new school project, to make a Telephone Billing System, and would be posting it soon after my project is over.

3 comments:

  1. If you are a gamer, you must have seen this kind of printing in Assassin's Creed, Ubisoft's most famous game. Experience the power of Java brought to you by ICSE Java Programs.

    ReplyDelete
  2. And yes, we are always on the lookout for such fantastic ideas to program. So if you have one, feel free to share it with us by just commenting about it.

    ICSE Java Programs.

    ReplyDelete
  3. I've been running throigh this blog, I'm in 9th, ICSE(Duh) and I've found quite a lot of stuff interesting. You should maybe move onto perhaps more advanced concepts like enumerators, polymorphism and eventually reach JAVA SWING. I've learnt all of these over the summer vacations and they're brilliant and handy to know.

    ReplyDelete

ShareThis