Question
This code should be done in Java thank you. 1. Create a program called Date.java with all kinds of overloaded constructors. In addition, have the
This code should be done in Java thank you.
1. Create a program called Date.java with all kinds of overloaded constructors. In addition, have the set() mutator method to perform error-checking on the properties month, day, and year.
Also, provide a method increaseByOneDay() to increment the day by one. Write a program called DateTest.java and have the increaseByOneDay() method tested in a loop of at least 100 iterations .
Test the following cases: a. Incrementing into the next month b. Incrementing into the next year Sample Program Output: Checking increment Date object constructor for date 11/27/2011 Incremented Date:11/28/2011 Incremented Date:11/29/2011 Incremented Date:11/30/2011 Day 31 invalid. Set to day 1. Incremented Date:12/1/2011 Incremented Date:12/2/2011 ... Incremented Date:12/30/2011 Incremented Date:12/31/2011 Day 32 invalid. Set to day 1. Incremented Date:1/1/2012 Incremented Date:1/2/2012 Incremented Date:1/3/2012 Incremented Date:1/4/2012 Incremented Date:1/5/2012 Incremented Date:1/6/2012
Step 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