Programming teacher asked ambiguous question.
My programming teacher (online course) asked me the following four questions for an assignment.
What do you think the class/object Calendar is?
What do you think the class/object Calendar does?
What do you think the class/object Date is?
What do you think the class/object Date does?
I understand that the Date class returns different values for the given parameters and that the Calendar interprets this information and in the context of the code he gave us it sets the value of an int variable for the day of the week.
The thing is I don't see what he wants me to tell him. What is does versus what it is. What does he mean by this?
Although this is probably irrelevant here is the code.
import java.util.*;
class selectionone{
publicstaticvoid main (String args[]){
Calendar cal = Calendar.getInstance();
Date now =new Date();
cal.setTime(now);
int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
if (dayofweek == Calendar.SUNDAY){
System.out.println("Eat at Joe's");
}elseif (dayofweek == Calendar.MONDAY){
System.out.println("Eat at Tom's");
}elseif (dayofweek == Calendar.TUESDAY){
System.out.println("Eat at Kevin's");
}elseif (dayofweek == Calendar.WEDNESDAY){
System.out.println("Eat at Jim's");
}elseif (dayofweek == Calendar.THURSDAY){
System.out.println("Eat at Fred's");
}elseif (dayofweek == Calendar.FRIDAY){
System.out.println("Eat at Jake's");
}elseif (dayofweek == Calendar.SATURDAY){
System.out.println("Eat at Home");
}else{
System.out.println("error");
}
}
}

