Create a Date class with the following capabilities:
a). Output the date in multiple formats such as
    MM/DD/YYYY
    June 14,1992
    DDD  YYYY

 b). Use the overload constractors to create Date objects initialized with dates of the formate( in part a).(File must be save as :Assignment7.java)


import javax.swing.JOptionPane;
class Dat
{
            String d;
            Dat(String s)
            {
                        d=s;
            }
            Dat(String m,String da,String y)
            {
                        d=m+"  "+da+"  "+y;
            }
            Dat(String da,String y)
            {
                        d=da+"  "+y;
            }
            void print()
            {
                        JOptionPane.showMessageDialog(null," "+d);
            }
}

class Assignment7
{
            public static void main(String args[])
            {
                        Dat r,a,b;
                        String s,st="",s1="",s2="",s3="",p;
                        char c[]=new char[40];
                        int x=0,y,i,n,n1;
                        s=JOptionPane.showInputDialog("Enter any date informat(MM/DD/YYY) : ");
                        r=new Dat(s);
                        //r.print();
                        y=s.length();
                        for(i=0;i<y;i++)
                        {
                                    c[i]=s.charAt(i);
                                    if(c[i]=='/')
                                    {
                                                x++;
                                                continue;
                                    }
                                    if(x==0)
                                    s1=s1+c[i];
                                    else if(x==1)
                                    s2=s2+c[i];
                                    else if(x==2)
                                    s3=s3+c[i];
                        }
                        n=Integer.parseInt(s1);
                        if(n<1||n>12)
                        {
                                    JOptionPane.showMessageDialog(null," Invalid Month.");
                                    System.exit(0);
                        }
                        n1=Integer.parseInt(s2);
                        if(n1<1||n1>31)
                        {
                                    JOptionPane.showMessageDialog(null," Invalid Day.");
                                    System.exit(0);
                        }
                        r.print();
                if(n==1)
                        st="january";
                        else if(n==2)
                        st="February";
                        else if(n==3)
                        st="March";
                        else if(n==4)
                        st="april";
                        else if(n==5)
                        st="May";
                        else if(n==6)
                        st="June";
                        else if(n==7)
                        st="July";
                        else if(n==8)
                        st="August";
                        else if (n==9)
                        st="September";
                        else if(n==10)
                        st="October";
                        else if(n==11)
                        st="November";
                        else if(n==12)
                        st="December";
                        else
                        st="Default manth";
                        st=st+" "+s2+",";
                        b=new Dat(st,s3);
                        b.print();
                        s2="Day "+s2;
                        s3="Year "+s3;
                        a=new Dat(s2,s3);
                        a.print();
                        System.exit(0);
            }
}


////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........