Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
java Tasks: Create a class called Date which has three instance variables - month (type integer), day (type integer) and year (type integer). a. The
java Tasks: Create a class called Date which has three instance variables - month (type integer), day (type integer) and year (type integer). a. The constructor receives the three parameters, invokes the utility method checkMonth to validate the month if the month is out of range set to 1 and invokes another method checkDay to validate the value of the day based on the current month and year. b. Provide a method nextDay to increment the day by one. Write a test application named Date App which test the method nextDay in a loop that prints the date during each iteration to illustrate that the method works correctly. Test the following cases. a. Incrementing into the next month. b. Incrementing into the next year. Sample Output: Checking increment Incremented Date: 12/17/1988 Date object constructor for date 11/27/1988 Incremented Date: 12/18/1988 Incremented Date: 11/28/1988 Incremented Date: 12/19/1988 Incremented Date: 11/29/1988 Incremented Date: 12/20/1988 Incremented Date: 11/30/1988 Incremented Date: 12/21/1988 Invalid day (31) set to 1. Incremented Date: 12/22/1988 Incremented Date: 12/1/1988 Incremented Date: 12/23/1988 Incremented Date: 12/2/1988 Incremented Date: 12/24/1988 Incremented Date: 12/3/1988 Incremented Date: 12/25/1988 Incremented Date: 12/4/1988 Incremented Date: 12/26/1988 Incremented Date: 12/5/1988 Incremented Date: 12/27/1988 Incremented Date: 12/6/1988 Incremented Date: 12/28/1988 Incremented Date: 12/7/1988 Incremented Date: 12/29/1988 Incremented Date: 12/8/1988 Incremented Date: 12/30/1988 Incremented Date: 12/9/1988 Incremented Date: 12/31/1988 Incremented Date: 12/10/1988 Invalid day (32) set to 1. Incremented Date: 12/11/1988 Incremented Date: 1/1/1989 Incremented Date: 12/12/1988 Incremented Date: 1/2/1989 Incremented Date: 12/13/1988 Incremented Date: 1/3/1989 Incremented Date: 12/14/1988 Incremented Date: 1/4/1989 Incremented Date: 12/15/1988 Incremented Date: 1/5/1989 Incremented Date: 12/16/1988 Incremented Date: 1/6/1989
java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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