不准访问
- 积分
- 223
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2017-3-8
- 最后登录
- 1970-1-1
|
本帖最后由 Wei Zhang 于 2017-3-29 22:25 编辑
It is the true time to draw some conclusions fot the hw2. I think conclusion is more important than the solution to question itself.
Following is my three steps to finish them.
1.completing the date.java
--use 2 hours finish
--the begining way to solve
--isLeapYear : the logic is vital. The impressive thing is to use a good && ||.
--isBefore and isAfter the connnection but also focus on the equal situation.
--dayinmonth, dayinyear : connection
--difference: use the dayinyear method
--Date(String s) use the String.split (search the API)
2.find out other people's solutions to compare with yourself and then modify your codes
--use 1 hour
--modify two things
--modify the (if else and && ||) such as the logic in isBefore() method (the goal is touse less if else but more || and &&) **
--modify the daysInYear() dont forget to use the dayInMonth() *****
3.conculusion
-- view the date.java in a broad way.
--in Date CLass: prviate field, two constructors, three static method(isLeapYear dayInMonth isValidDate, think why???) toString().
--the connection among some methods.
|
|