Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

8.14 (Date Class) Create class Date with the following capabilities: a) Output t

ID: 3647417 • Letter: 8

Question

8.14 (Date Class)

Create class Date with the following capabilities:
a) Output the date in multiple formats, such as
MM/DD/YYYY
June 14, 1992
DDD YYYY
b) Use overloaded constructors to create Date objects initialized with dates of the formats
in part (a). In the first case the constructor should receive three integer values. In the
second case it should receive a String and two integer values. In the third case it should
receive two integer values, the first of which represents the day number in the year.
[Hint: To convert the string representation of the month to a numeric value, compare
strings using the equals method. For example, if s1 and s2 are strings, the method call
s1.equals( s2 ) returns true if the strings are identical and otherwise returns false.]


Help: See the java file and search for "To do" list. The input and output are both in main method.

Explanation / Answer

I'm not going to write the whole class for you, but I will give you some hints... Use the SimpleDateFormat class to transform the dates into the format you require. For example for June 14, 2001 you can use: SimpleDateFormat format = new SimpleDateFormat("MMMM dd, yyyy") ; You can then use the format method to get a String representation of a Date object: String output = format.format(new Date()) ; This will allow you to output the Date in a certain format.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote