i need a code for this java program...urgent please...
using dialog boxes :
input month in "99" form
date in "99" form
year = 2009
then display the date in 'MMM 99, 2009' form
otherwise, display 'invalid date'

Valid date
01-12 = Values for month
01-28 = for month - 2
01-30 = for months - 4,6,9,11
01-31 = for months - 1,3,5,7,8,10,12

Recommended Answers

All 2 Replies

...
 boolean isvalid=true;
 switch(m) {
     case 1:
     case 3:
     case 5:
     case 7:
     case 8:
     case 10:
     case 12:
                  if(d<1 || d>31)
                        isvalid=false;
                  break;
    case 4:
    case 6:
    case 9:
    case 11:
                ...
                break;
    case 2:
               ....
               break;
   ....  
 }
...

As I told you in your multipost:

Okay? So what do you have, and what error/compiler messages are you getting from it, or what is it doing that you don't expect, or vice-versa.

You will notice the terms and conditions of this site (which you agreed to when you signed up here), forbid us simply giving you a solution to your homework (as if we would, anyway).

P.S. Unless forbidden for you to use it, use SimpleDateFormat not any kind of case or "home-grown" solution. Why reinvent the wheel.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.