Question: can you please solve this whole code date should be in the form: mm/dd/yyyy with mm, dd, and yyy being a digit. DO NOT worry
can you please solve this whole code
date should be in the form: mm/dd/yyyy with mm, dd, and yyy being a digit. DO NOT worry about the numbers being realistic (1 through 12 for month, 1 through 31 for days, etc.). Just check to make sure there are digits, two slashes and 10 characters in total. - In class, I mentioned we can check user inputs before setting attribute values. Let's do this for the date attribute: Edit your setDate method by calling the checkDate method first before setting the instance variable, date. If the date is not valid, you should print out, "Date not valid" and then use System.exit(0); to make the program exit. Else, if the date is valid, set the date as you already did. - We can take this a step further and call our setDate method in the constructor body to assign the instance variable for date for us. This will make also make it so our date is being checked. How do you think we could do this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
