|
Comp201: Principles of Object-Oriented Programming I
|
You will need to use Full Java language level for this assignment.
import java.util.*; // This is to make use of the Calendar class and GregorianCalendar class // that come with Java.
public class SmarterPerson { private Calendar _cal;
/**
* Initializes _cal to a concrete GregorianCalendar that corresponds to the day, month
* and year given in the parameter list.
* For example: new SmarterPerson(28, 2, 1945) will create a SmarterPerson object with
* birth date February 28, 1945.
* @param day the birth day ranging from 1 to 31
* @param month the birth month ranging from 1 to 12
* @param year the birth year, a positive integer.
*/
public SmarterPerson(int day, int month, int year) {
// STUDENT TO WRITE CODE
// WARNING: the month number for the Calendar class ranges from 0 to 11.
}
/** * Computes the number of months till the next birth day given the current month. * Must give the same answer as a Person object with the same birth month. * @param currentMonth an int ranging from 1 to 12 representing the current month. */ public int nMonthTillBD(int currentMonth) { // STUDENT TO WRITE CODE return 0; // TO DO!!! } /** * Computes the number of days from the first of the current year till the birth day. */ public int nDaysFromNewYearToBD() { // STUDENT TO WRITE CODE return 0; // TO DO!!! } }
Hints -- these will be updated continuously as people ask questions. Check back often!:
105 pts total.
When you have completed your homework, zip up the entire HW03 directory and submit the zipped file to your Comp201 WEBCT account.
Last Revised Thursday, 03-Jun-2010 09:50:12 CDT
©2006 Stephen Wong and Dung Nguyen