I've been working on a pair of programs (driver and driven) that will accept input in the form of numbers a slash mark and numbers, which represent the month and day. The program error checks the input for valid numbers and then prints a line with the numbers as entered (mm/dd) and with the month spelled out (Month dd). Unfortunately, my code is somehow reversing the value for the date (i.e. 02/05=May 2).
I'm sure this is something simple I'm overlooking, but I've been scouring this code all day and can't find it. Any help would be greatly appreciated.
Because this is a project for a class with very specific requirements. For instance the driven class portion of the program must be named, "Date.java" and the driver named "LastnameFirstnameDateDriver.java". It also must include a Date constructor that receives a string called dateStr. It must error check the input using try/catch.
Unfortunately now I've been error checking, rewriting, adding, deleting for so long now, I'm not sure where I'm at...looking over the code, I suspect I have complicated it more than it needs to be.
I'm sorry to be asking, but can you help look through my code and streamline/debug?
You expect the input format to be mm/dd - but this is not what you expect in your Date code.
You start with finding the date delimiter '/', then you try to find the month, but is is the day you select (spot + 2) - and then you try to find the day, but also here you select the wrong one, you select the month (spot -1)