楼主: jaly50
跳转到指定楼层
上一主题 下一主题
收起左侧

Berkeley CS 61B Data Structures(in Java) Homework2 加分+讨论帖

 
🔗
VolEmma 2017-3-15 11:10:32 | 只看该作者
全局:
完成作业后对于一个class应该有的结构有了更深的认知

hw2.png (185.35 KB, 下载次数: 1)

differences想了很久,分段得出结论,看了讨论里的方法觉得更加精辟

differences想了很久,分段得出结论,看了讨论里的方法觉得更加精辟

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
AllenChen 2017-3-17 21:11:22 | 只看该作者
全局:
用了上面有人提到的dayInAll()方法,代码重用度高,也更简单了,一开始用的分类讨论真的好麻烦。
还学会议一个新的 String[] d=s.split("/"),也是上面小伙伴提到的。很感谢阿童木 的总结,帮助很大,给了我很多新的思路

H2.JPG (64.23 KB, 下载次数: 0)

H2.JPG

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
sparrow52 2017-3-18 15:16:36 | 只看该作者
全局:
HW 2:
1. 缺少返回值:原因:如果不用if...else,java会认为有的条件下没有返回值。在考虑完所有逻辑可能之后,再最后加一个return 0/return false就可以了。

2. When there are two reverse-function methods( like isBefore & isAfter, build one and use it in the other's building)



评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
ienric 2017-3-19 00:19:32 | 只看该作者
全局:
学会了String.matches()和String.split(),还是蛮好用的。。。。同时对于toString也有了新的理解

homeWork2.jpg (77.49 KB, 下载次数: 0)

结果

结果

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

全局:
看了之前楼层的想法,学会了match和split两个方法。我在做的时候并没有用这两个方法,用了最笨的逻辑判断。。


回复

使用道具 举报

🔗
huangzshi 2017-3-24 18:37:55 | 只看该作者
全局:
交作业

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
irenezh 2017-3-26 18:51:05 | 只看该作者
全局:

Homework2 好好学习 天天向上!

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
yagougou 2017-3-29 10:43:07 | 只看该作者
全局:
各种小问题太多了

1490755352(1).png (26.64 KB, 下载次数: 0)

1490755352(1).png

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
Wei Zhang 2017-3-29 21:25:28 | 只看该作者
全局:
本帖最后由 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.

data.PNG (20.47 KB, 下载次数: 1)

date

date

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
rngzaozige 2017-3-31 00:14:00 | 只看该作者
全局:
本帖最后由 ddh 于 2017-3-31 00:16 编辑

弄了好久才做出来
更多图片 小图 大图
组图打开中,请稍候......

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表