Create a DateTime class that contains month, day,
year, hour, minute, second.
Don’t forget useful constructors and observers.
Plus also make sure to have toString for your date.
Add useful date functions:
Add seconds – take int and create a new date
adding the specified number of seconds.
Add days – take int and create a new date
adding the correct number of days.
Diff seconds – take another date and return
the difference in seconds (int).
Diff days – take another date and return
the difference in days (double).
DateTime d1 = new DateTime(10,31,2018,15,28,10);
S.o.p(“Today is ” + d1);//-> 10/31/2018 15:28:10
DateTime d2 = d1.addDays(7);
S.o.p(“Next week is ” + d2);//-> 11/7/2018 15:28:10
DateTime d3 = d1.addDays(60);
S.o.p(“Two months is ” + d3);//-> 12/30/2018 15:28:10
DateTime d4 = new DateTime(11,5,2018,3,28,10);
S.o.p(“Another day is ” + d4);//-> 11/5/2018 3:28:10
double diff = d1.diffDays(d4);
S.o.p(“Time between ” + d1 + ” and ” + d4 +
” is ” + diff); //-> 4.5
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!Use Discount Code “Newclient” for a 15% Discount!NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.