星期一, 12月 05, 2005

Lab 12-5-2005 (2) Overloading

Step 1. Do Display 4.11 (4.9, 1st ed.) and use Display 4.12 (4.10 1st ed.) to call 4.11. (4.9 1st ed.)

Step 2.

Add two method definitions
public void setMonth(int month)
public void setMonth(String month)

Step 3.

Use Display 4.12
and change the codes in yellow shaded area as
date1.setDate(1,2,2007);
date1.setMonth(3);
date2.setDate("Feb",2,2007);
date2.setMonth("Apr");
date3.setDate(2007);

Step 4. Show the results of your program execution.

9 則留言: