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");

}

}

}

[3130 byte] By [Crazed_climbera] at [2007-11-26 16:02:32]
# 1

Given that we're talking about an object-oriented programming language here, he probably (for "is") wants you to tell him what a given class represents or models, and (for "does") what methods or functionality or behavior the class exhibits as part of that representation.

paulcwa at 2007-7-8 22:24:20 > top of Java-index,Java Essentials,New To Java...
# 2
Though I don't know what that code example has to do with it. So maybe he meant something else.
paulcwa at 2007-7-8 22:24:20 > top of Java-index,Java Essentials,New To Java...
# 3
Ok so (for "is") he probably wants a broader answer of what the class was designed to do and (for "does") he wants to know how it was implemented in the code?I emailed him but his responses are slow. I don't like how this question was worded.
Crazed_climbera at 2007-7-8 22:24:20 > top of Java-index,Java Essentials,New To Java...
# 4

> Ok so (for "is") he probably wants a broader answer

> of what the class was designed to do

Hmm.. I thought he wanted to know that the class represents. The purpose of the class.

> and (for "does")

> he wants to know how it was implemented in the code?

No, you shouldn't know how it is implemented, so he probably wants to know how the class can be used.

I might of course be totally off here :)

kajbja at 2007-7-8 22:24:20 > top of Java-index,Java Essentials,New To Java...
# 5

E.g.

What do you think the class/object Long is?

It's a wrapper class for long primitives.

What do you think the class/object Long does?

It acts as a wrapper for primitives so that they can be used as Objects. The class does also make it possible to parse a String into a long, and to print longs in different radixes (or whatever that is called in English :)

Kaj

kajbja at 2007-7-8 22:24:20 > top of Java-index,Java Essentials,New To Java...