Total members 10259 | Gratitudes |It is currently Mon May 21, 2012 3:55 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Topic
 Topic subject: Calendar Generator
PostPosted: Fri Oct 17, 2008 1:12 am 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2277
Location: Earth
Has thanked: 39 time
Have thanks: 61 time

* Project Name:   Calendar Generator
* Programmer:   Vipul Agrawal (CooLByteS)
* Type:   Algorithm
* Technology:  Java
* IDE:   Any
* Description:   It will generate calendar of any month of the years starting from 1000 A.D to Infinity

Code:
Code :
// Made by Vipul Agrawal (CooLByteS) Visit us at www.coolbytes.tk

import java.io.*;
class cal1
{
        public static void main(String hj[]) throws Exception
        {
                welcome();
                code();
        }
        static void welcome() throws Exception
        {       DataInputStream in = new DataInputStream(System.in);
                for(int y=0;y<24;y++)
                {
                        System.out.println();
                }
                String st1=new String("       ~~~~            |
|~~~~  |    |  |~~~            |~~~  ");
                String st2=new String("                      |     
|
|    |  |              |     ");
                String st3=new String("               ---    |
|===   |    |  |       ---    |===  ");
                String st4=new String("                      |     
|
|    |  |              |     ");
                String st5=new String("       ____           |____
|____  |    |  |___           |     ");
                char s1[]=new char[30];
                char s2[]=new char[30];
                char s3[]=new char[30];
                char s4[]=new char[30];
                char s5[]=new char[30];
                s1=st1.toCharArray();
                s2=st2.toCharArray();
                s3=st3.toCharArray();
                s4=st4.toCharArray();
                s5=st5.toCharArray();
                int len=st1.length();
                for(int op1=0;op1<len;op1++)
                {       Thread.sleep(5);
                        System.out.print(s1[op1]);
                }
                System.out.println();
                for(int op2=0;op2<len;op2++)
                {       Thread.sleep(5);
                        System.out.print(s2[op2]);
                }
                System.out.println();
                for(int op3=0;op3<len;op3++)
                {       Thread.sleep(5);
                        System.out.print(s3[op3]);
                }
                System.out.println();
                for(int op4=0;op4<len;op4++)
                {       Thread.sleep(5);
                        System.out.print(s4[op4]);
                }
                System.out.println();
                for(int op5=0;op5<len;op5++)
                {       Thread.sleep(5);
                        System.out.print(s5[op5]);
                }
                int u=0;
                for(u=0;u<3;u++)
                {
                        System.out.println();
                }
                System.out.println("                          LIMIT =
1000
A.D - INFINITY");
                for(u=0;u<10;u++)
                {
                        System.out.println();
                }
                System.out.print("SPONSERED BY : ");
                String name=new String("Vipul Agrawal");
                char n1[]=new char[25];
                int l=name.length();
                n1=name.toCharArray();
                for(int nm=0;nm<l;nm++)
                {       Thread.sleep(80);
                        System.out.print(n1[nm]);
                }
                in.readLine();
                for(int p=0;p<24;p++)
                {
                        System.out.println();
                }
         }
        static void code() throws Exception
        {
               DataInputStream in = new DataInputStream(System.in);
                String str;
                do{
                   int ch;
                   int i,t=0,j=0,b=0,a=0;
                   int y1=0,m1=0;
                   System.out.println();
                   do{
                      System.out.println("Enter the month");
                      try{
                      m1=Integer.parseInt(in.readLine());
                      }catch(NumberFormatException tt)
                      {
                        System.out.println("Enter Integer Only");
                        System.out.println();
                      }
                      if(m1<1 || m1>12)
                      {
                        System.out.println("Invalid Input");
                        System.out.println();
                      }
                   }while(m1<1 || m1>12);
                    for(i=0;i<24;i++)
                      System.out.println();
                   do{
                        System.out.println("Enter the Year from 1000
onwards");
                        try{
                        y1=Integer.parseInt(in.readLine());
                        }
                        catch(NumberFormatException tt)
                        {
                        System.out.println("Enter Integer Only");
                        System.out.println();
                        }
                        if(y1<1000)
                        {
                                System.out.println("Invalid Input");
                        }
                     }while(y1<1000);
                     int d=2;
                     int m=1;
                      int y=1000;
               while(true)
               {    if(m1<=m && y1<=y)
                    {
                    for(i=0;i<24;i++)
                    System.out.println();

                    for(i=0;i<33;i++)
                    System.out.print(" ");

                       System.out.println("CALENDAR "+y);
                    System.out.println();

                    for(i=0;i<33;i++)
                    System.out.print(" ");

                       if(m==1)
                       System.out.println("   JANUARY");
                             if(m==2)
                             System.out.println("  FEBRUARY");
                       if(m==3)
                       System.out.println("    MARCH");
                             if(m==4)
                             System.out.println("    APRIL");
                       if(m==5)
                       System.out.println("    MAY");
                             if(m==6)
                             System.out.println("    JUNE");
                       if(m==7)
                       System.out.println("   JULY");
                             if(m==8)
                             System.out.println("   AUGUST");
                       if(m==9)
                       System.out.println(" SEPTEMBER");
                             if(m==10)
                             System.out.println("   OCTOBER");
                       if(m==11)
                       System.out.println("   NOVEMBER");
                             if(m==12)
                             System.out.println("   DECEMBER");

                      System.out.println();

                             for(i=0;i<7;i++)
                             System.out.print(" ");
                                System.out.print("MON");

                             for(i=0;i<7;i++)
                             System.out.print(" ");
                                System.out.print("TUE");

                             for(i=0;i<7;i++)
                             System.out.print(" ");
                                System.out.print("WED");

                             for(i=0;i<7;i++)
                             System.out.print(" ");
                                System.out.print("THU");

                             for(i=0;i<7;i++)
                             System.out.print(" ");
                                System.out.print("FRI");

                             for(i=0;i<7;i++)
                             System.out.print(" ");
                                System.out.print("SAT");

                             for(i=0;i<7;i++)
                             System.out.print(" ");
                                System.out.print("SUN");
                             System.out.println();
                             System.out.println();
                             System.out.println();
                         }
                                    int w,mn;
                                    if(y1==y && m1==m)
                                    {
                                    for(i=0;i<t;i++)
                                    {
                                        System.out.print(" ");
                                    }
                                    for(;d>1;d--)
                                    {   for(j=0;j<10;j++)
                                        {
                                                System.out.print(" ");
                                                t++;

                                        }
                                    }
                                    }
                                    else
                                    {
                                    for(i=0;i<t;i++)
                                    {
                                    }
                                    for(;d>1;d--)
                                    {   for(j=0;j<10;j++)
                                        {
                                                t++;

                                        }
                                    }
                                    }
                                    if(m==1 || m==3 || m==5 || m==7 ||
m==8 || m==10 || m==12)
                                    {
                                                for(i=1;i<=31;i++)
                                                {
                                                      if(y1==y &&
m1==m)
                                                      {
                                                       
for(j=0;j<8;j++)
                                                        {

System.out.print(" ");
                                                            t++;
                                                        }
                                                        if(i>=10)

System.out.print(i);
                                                        else

System.out.print(" "+i);
                                                        t+=2;
                                                        if(t>=70)
                                                        {

System.out.println();

System.out.println();
                                                        t=0;
                                                        }
                                                     }
                                                     else
                                                     {
                                                       
for(j=0;j<8;j++)
                                                        {
                                                          t++;
                                                        }
                                                        if(i>=10)
                                                        {
                                                        }
                                                        else
                                                        {
                                                        }
                                                        t+=2;
                                                        if(t>=70)
                                                         {
                                                         t=0;
                                                         }
                                                     }
                                              }

                                    }
                                    if(m==4 || m==6 || m==9 || m==11)
                                    {
                                                for(i=1;i<=30;i++)
                                                {
                                                      if(y1==y &&
m1==m)
                                                      {
                                                       
for(j=0;j<8;j++)
                                                        {

System.out.print(" ");
                                                            t++;
                                                        }
                                                        if(i>=10)

System.out.print(i);
                                                        else

System.out.print(" "+i);
                                                        t+=2;
                                                        if(t>=70)
                                                        {

System.out.println();

System.out.println();
                                                        t=0;
                                                        }
                                                     }
                                                     else
                                                     {
                                                       
for(j=0;j<8;j++)
                                                        {
                                                          t++;
                                                        }
                                                        if(i>=10)
                                                        {
                                                        }
                                                        else
                                                        {
                                                        }
                                                        t+=2;
                                                        if(t>=70)
                                                         {
                                                         t=0;
                                                         }
                                                     }

                                                }
                                      }
                                      if(m==2)
                                      {
                                              if(y%4!=0)
                                              {
                                                for(i=1;i<=28;i++)
                                                {
                                                      if(y1==y &&
m1==m)
                                                      {
                                                       
for(j=0;j<8;j++)
                                                        {

System.out.print(" ");
                                                            t++;
                                                        }
                                                        if(i>=10)

System.out.print(i);
                                                        else

System.out.print(" "+i);
                                                        t+=2;
                                                        if(t>=70)
                                                        {

System.out.println();

System.out.println();
                                                        t=0;
                                                        }
                                                     }
                                                     else
                                                     {
                                                       
for(j=0;j<8;j++)
                                                        {
                                                          t++;
                                                        }
                                                        if(i>=10)
                                                        {
                                                        }
                                                        else
                                                        {
                                                        }
                                                        t+=2;
                                                        if(t>=70)
                                                         {
                                                         t=0;
                                                         }
                                                     }
                                                }
                                              }
                                              else
                                              {
                                                for(i=1;i<=29;i++)
                                                {
                                                      if(y1==y &&
m1==m)
                                                      {
                                                       
for(j=0;j<8;j++)
                                                        {

System.out.print(" ");
                                                            t++;
                                                        }
                                                        if(i>=10)

System.out.print(i);
                                                        else

System.out.print(" "+i);
                                                        t+=2;
                                                        if(t>=70)
                                                        {

System.out.println();

System.out.println();
                                                        t=0;
                                                        }
                                                     }
                                                     else
                                                     {
                                                       
for(j=0;j<8;j++)
                                                        {
                                                          t++;
                                                        }
                                                        if(i>=10)
                                                        {
                                                        }
                                                        else
                                                        {
                                                        }
                                                        t+=2;
                                                        if(t>=70)
                                                         {
                                                         t=0;
                                                         }
                                                     }

                                                }

                                        }
                              }
                              if(y1==y && m1==m)
                              {
                              for(j=0;j<4;j++)
                              {
                                System.out.println();
                              }
                              }
                              if(m1<=m && y1<=y)
                              {
                                break;
                              }
                              if(m==12)
                              {
                                    y++;
                                    m=1;
                              }
                              else
                              {
                                m++;
                              }

                       }
                       while(true){
                       System.out.println("Want see another calendar
(y/n)?");
                       str=in.readLine();
                       if(str.equals("Y") || str.equals("y") ||
str.equals("N") || str.equals("n"))
                       {
                               break;
                       }
                       else
                       {
                                System.out.println("Invalid Input");
                       }
                       }
               }while(str.equals("y") || str.equals("Y"));
       }
}




Author mail : vipul@coolbytes.info

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  


 Similar topics
 simple javascript calendar
 Calendar dates program: Please help!
 java.util Calendar To TimeStamp
 JPA entity with table generator
 Sequence Generator JPA
 Pseudo Randon Number Generator code??
 Prime Generator Algorithm
 Histogram Generator
 draw Calendar in java
 HTML Table Of Contents Generator

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 3 guests



Jump to:  
Previous Topic | Next Topic 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team