• 沒有找到結果。

1Description Homework#3

N/A
N/A
Protected

Academic year: 2022

Share "1Description Homework#3"

Copied!
2
0
0

加載中.... (立即查看全文)

全文

(1)

Object Oriented Software Design (NTU, Class 01/02, Spring 2010) instructor: Hsuan-Tien Lin

Homework #3

RELEASE DATE: 04/02/2010 DUE DATE: 04/29/2010, noon

As directed below, you need to upload your submission file to the designated place on the course website.

Any form of cheating, lying or plagiarism will not be tolerated. Students can get zero scores and/or fail the class and/or be kicked out of school and/or receive other punishments for those kinds of misconducts.

Discussions on course materials and homework solutions are encouraged. But you should write the final solutions alone and understand them fully. Books, notes, and Internet resources can be consulted, but not copied from.

Since everyone needs to write the final solutions alone, there is absolutely no need to lend your homework solutions and/or source codes to your classmates at any time. In order to maximize the level of fairness in this class, lending and borrowing homework solutions are both regarded as dishonest behaviors and will be punished according to the honesty policy.

Both English and Traditional Chinese are allowed for writing any part of your homework (if the compiler recognizes Traditional Chinese, of course). We do not accept any other languages.

1 Description

When POOBBS started, some programmers designed a class called ntu.csie.oop10spring.POOArticle for storing the information of each article on the BBS. Each article contains only three pieces of information:

its author, its title and its content.

Nevertheless, the POOArticle class does not fully serve the needs nowadays. In particular, it does not contain an unique ID for each article to allow easy reference; it does not have an evaluation count that records the number of “pushes” or “boos” per article; it does not have an array that stores lines of comments from the author. Thus, the POOArticle class needs some renovation—or expansion in the OO terminology.

You, as the core programmer of the POOBBS, are asked by the programming team to design a new class called ntu.csie.oop10spring.POOAdvArticle that extends POOArticle. The POOAdvArticle class should inherit all the public instance methods from POOArticle, while having the following new public instance methods:

• a “void push(String)” method that increases the evaluation count by 1, and adds a line to the comments

• a “void boo(String)” method that decreases the evaluation count by 1, and adds a line to the comments

• an “void arrow(String)” method that does not change the evaluation count, and adds a line to the comments

• a “int getID()” method that returns the integer ID of an article

• a “String[] getComment()” method that returns the comments (each line as an element of the array)

• an updated “void showShort()” method that shows the evaluation count, the author and the title

• an updated “void showAll()” method that shows the ID, the author, the title, the content and the comments

• an updated constructor “POOAdvArticle(String author, String title, String[] content)” that assigns an unique integer ID to each POOAdvArticle in addition to setting the author, title and content.

Furthermore, please write a ntu.csie.oop10spring.POOAdvArticleDemo class that demonstrates all the features that POOAdvArticle provides. The TAs will evaluate your code with two ways:

• Use your POOAdvArticleDemo and see if you demonstrated that all features are reasonably imple- mented.

1 of 2

(2)

Object Oriented Software Design (NTU, Class 01/02, Spring 2010) instructor: Hsuan-Tien Lin

• Use a secrete POOAdvArticleDemoTA class to call your instance methods and see if things behave well.

Thus, it is very important to follow the contracts above for designing the POOAdvArticle class.

2 Requirements

• Read the document of the ntu.csie.oop10spring.POOArticle class (source code NOT provided), and extend it in your program.

• Write the code for the ntu.csie.oop10spring.POOAdvArticle class described above. Note that readability of your source code would be worth 10 points out of 100 this time. That is, your grading TA would give you points based on the following qualitative measure:

10 very readable 8 readable

6 mostly readable, but with some unreadable parts 4 mostly unreadable, but with some readable parts 2 unreadable

0 very unreadable

• Write a short report with at most three A4 pages that contains the following items:

(1) your name and school ID

(2) how you tested the correctness of your program

(3) some sample output from your ntu.csie.oop10spring.POOAdvArticleDemo (4) any part that you implemented that is worth getting “bonus” points

You should submit your report in PDF format. See the course forum for some possible instructions for converting from Word to PDF.

3 Submission File

Please upload a single ZIP encrypted file to CEIBA. The zip file should be like b86506054.zip, where the file name should be changed to your own school ID. The ZIP file should contain the following items:

• POOAdvArticle.java

• POOAdvArticleDemo.java

• any other java code that you write

• compile.sh or compile.bat: the commands for the TAs to compile your source files from the command line

• Your report file in PDF format

2 of 2

參考文獻

相關文件

In your reading assignments this week, you should learn how to construct, or initialize, an instance of the class by a special function called the constructor.. Yes, we know that

If both a compute-bound process and an I/O-bound process are waiting for a time slice, which should be given

Enclosing inclusions using acoustic and elastic waves In this section we will consider the enclosure method for the case where the unknown domain is an inclusion by using acoustic

D) Enzymes are consumed by the reaction while inorganic catalysts do not undergo a chemical change..

The difference in heights of the liquid in the two sides of the manometer is 43.4 cm when the atmospheric pressure is 755 mm Hg.. 11) Based on molecular mass and dipole moment of

The Task Force fully recognises students’ diverse learning and development needs across different key stages and domains, and hence the recommendations need to be considered in

(3) Answers to Section A should be marked on the Multiple-choice Answer Sheet while answers to Section B should be written in the spaces provided in Question-Answer Book.. The

In this paper, we define various means associated with Lorentz cones (also known as second-order cones), which are new concepts and natural extensions of traditional arithmetic