(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!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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