Calendar cal = Calendar.getInstance(); int myYear = cal.get(Calendar.YEAR); will
ID: 3612860 • Letter: C
Question
Calendar cal = Calendar.getInstance();
int myYear = cal.get(Calendar.YEAR);
will get the current year (right now it willmake myYear have the value 2008)
Assume that class Employee has a field dobwhich is a string in the format mm/dd/yyyy.
Implement (i.e. write the body of) thefollowing method of class Employee:
public int getAge( ){
//returns this Employee's currentage
2) Implement the followingmethod:
static boolean isOkDate( int month, intday){
//returns true if month,day is a possiblecombination (where 0,3 represents January 3rd)
//(February 29 is ok. But -1,5 or 3,92 or 10,31 (November 31?)are all not ok
Explanation / Answer
please rate - thanks CRAMSTER rule-1 question per post, rate and post another questionwith the class and I'll do it the input for month is 1-12 however it is passed to the method, andthe method expects 0-11. are you sure this is what you want themonths to start at 0, the days to start at 1, this is inconsistentcoding! if you want to change it so months start at 1 change if(day>0&&day0&&day0&&dayRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.