1. A constructor that takes its year,month,day as parameters and another version
ID: 3637530 • Letter: 1
Question
1. A constructor that takes its year,month,day as parameters and another version that takes all of the properties via parameters; namely, year,month,day,hour, minute and second.2. A constructor that takes a string in the form “2/12/2011”, or “2-12-2011” or “2-12-2011 5:55:32” and it should parse the string and get its values from the string.
3. The calendar class should allow usage of AM/PM vs 24 Hour formats for its time representation.
4. It should use exceptions for handling error and exception cases. For example, cal.setDay(45) should cause an error/exception.
5. Comment your code and document your fields/methods so people can understand what they do without having to read your code.
6. It should give methods to advance its fields, such as advancing the year or months with things like this:
Explanation / Answer
1. A constructor that takes its year,month,day as parameters and another version that takes all of the properties via parameters; namely, year,month,day,hour, minute and second. 2. A constructor that takes a string in the form “2/12/2011”, or “2-12-2011” or “2-12-2011 5:55:32” and it should parse the string and get its values from the string. 3. The calendar class should allow usage of AM/PM vs 24 Hour formats for its time representation. 4. It should use exceptions for handling error and exception cases. For example, cal.setDay(45) should cause an error/exception. 5. Comment your code and document your fields/methods so people can understand what they do without having to read your code. 6. It should give methods to advance its fields, such as advancing the year or months with things like this:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.