Question: Given the following declaration for a class called Date with one contractor and one incomplete method: public class date { int day, month, year: public
Given the following declaration for a class called Date with one contractor and one incomplete method: public class date { int day, month, year: public date () { day = 1: month = 1: year = 2000: } //Complete the following method that advances any date (object) by any number of//day (s) greater than or equal to zero and returns the new Data. For example: if we have (i) Date d1 = new Date (): rightarrow d1 is now 1/1/2000 (ii) dl = dl.add_days (40) dl is now 2/11/2000 (iii) dl = d1. add_days (361) dl is now 1/11/2001 public Date add_days (int n) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
