Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 thisStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started