File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Crazy date program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Crazy date program" Watch "Crazy date program" New topic

Crazy date program

Robert Mabrey

Joined: Apr 02, 2008
Posts: 9
I fixed my original problem but now this code only works up to a certain point. I had it working fine but then i changed some variable names and i messed up something and im not sure what. It stops where the ***** are and wont doing anything below.Hopefully you more experienced programmers out there can tell me what is wrong. thanks

[ April 29, 2008: Message edited by: Robert Mabrey ]
[ April 29, 2008: Message edited by: Robert Mabrey ]
abhishek pendkay
Ranch Hand

Joined: Jan 01, 2007
Posts: 184
Hi Robert , your program is fine except for one logical error you made

check out the first line of your code after **************************

if(0<day&&day>=31) this if condition is not correct , the correct condition would be if(0<day&&day<=31)
now your program should work fine
you were originally checking if day is greater than 0 and greater than 31 , but you should have checked if day greater than 0 and less than or equal to 31...
also after the condition if(month == 2) you have missed out a bracket , so check that too
[ April 29, 2008: Message edited by: abhishek pendkay ]

The significant problems we face cannot be solved by the same level of thinking which created them – Einstein
SCJP 1.5, SCWCD, SCBCD in the making
Robert Mabrey

Joined: Apr 02, 2008
Posts: 9
Thank you i did find the bracket and that fixed it however I did not notice the (0<d&&d<=31) Program works fine now

again thank you
I agree. Here's the link:
subject: Crazy date program
It's not a secret anymore!