Total members 11890 |It is currently Sat Apr 20, 2024 2:10 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka






* 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 : [email protected]



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Calendar Generator
 draw Calendar in java     -  
 Programming Calendar Java     -  
 simple javascript calendar     -  
 java.util Calendar To TimeStamp     -  
 Sequence Generator JPA     -  
 Histogram Generator     -  
 Prime Generator Algorithm     -  
 JPA entity with table generator     -  
 HTML Table Of Contents Generator     -  
 Pseudo Randon Number Generator code??     -  



Topic Tags

Java Time







Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com