(a) Create a java class MyDate that keeps track of the date as day, month and year of type integer and provide the following met | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

(a) Create a java class MyDate that keeps track of the date as day, month and year of type integer and provide the following met

(a) Create a java class MyDate that keeps track of the date as day, month and year of type integer and provide the following methods                                                       (10 marks) (i) MyDate (int day, int month, int year) constructor to create the date object with given day,month and year. (ii) Boolean is LeapYear () returns true if the year is a leap year. A year is a leap year if it is divisible by 4 but not by 100, or it is divisible by 400. 3 / 3 (iii) String getDayofWeek (): return the day of the week, where 0 for Sunday, 1 for Monday, 6 for Saturaday. (iv) In the main method, create two date objects and print their informations.              

21st Dec 2022, 1:27 PM
Moe papa Aung
2 Answers
+ 1
Here is a sample code. You can change the values as per your need. https://code.sololearn.com/c0N6Turel1HV/?ref=app I coded this class based on what I understood from the question. Therefore, some things may be incorrect. So please correct them as per your needs.
24th Dec 2022, 7:11 AM
Rivan
0
Thank you so much! This helps a lot 🙏
24th Dec 2022, 1:25 PM
Moe papa Aung