2024 Java 軟體開發 綜合討論
以下說明作業格式。
作業壓縮檔
請同學先在 Eclipse 的環境下(或自己平常使用的IDE)完成自己的作業,並依照以下說明及規定打包作業。最後請將打包完成的壓縮檔上傳至 Moodle 繳交作業。
壓縮檔格式
壓縮檔名應為大寫字母之學號且格式為 zip,例如 P76054151.zip
不論是哪一次作業,壓縮檔的結構皆如下:
作業壓縮示例
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
⚠️
如果是使用MacOS繳交作業的同學請特別注意,若是您是使用第三方軟體將作業進行壓縮的話,仍可能會產生編譯上的錯誤,因此請同學使用MacOS內建的壓縮程式進行壓縮方可避免此錯誤產生。
MANIFEST.MF
MANIFEST.MF
為本課程用來批改程式作業的設定檔,非執行檔。每次作業都須修改此檔案來提示每次作業的程式進入點,也就是你要告訴我們 Main Class 的 java 檔在哪裡,這個檔案可以直接用文字編輯器開啟編輯,可以從 Example File 中複製修改內容或者直接新增文件並且將檔名更改成 MANIFEST.MF
即可(副檔名為.MF),而這個檔案的檔名、內容格式與檔案位置(一定要在 META-INF 資料夾內)不能變更。
MANIFEST.MF
的內容只有兩行,範例如下:
第一行無須更改,第二行為程式進入點,格式為 PackageName.MainClassName。
舉例來說,範例中的 demo.Demo1
,demo
為 PackageName,Demo1
為 MainClassName,因此你的 src 資料夾中應該會有一個名為 demo 的資料夾:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
裡面剛好有一個名為Demo1的java檔:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
而 Demo1.java 裡面又剛好有你寫的 Main,而且程式裡剛好有宣告你用來放檔案的 package:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
換句話說,假如你原本的 Java Project 裡沒有使用 Package 的話, MANIFEST 的 Main-Class 則無須填寫 PackageName 跟後面的".",只需要填寫 MainClassName,如 Demo1,src 資料夾中也不需要有其他的資料夾,直接放上你的 java 檔就好。
src
最直接的做法就是開啟你 Java Project 的位置,並且把 Project 的整個 src 打包進你的壓縮檔即可。
若是不知道你的 Project 被放在哪裡,可以在 Project上 按右鍵 > Show In > System Explorer,就會開啟你這個 Project 的位置:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
格式
輸入格式
不同作業會使用不同的輸入格式,通常為 Argument(args[]) 或 Scanner,請確認自己是否符合作業需求,不符合需求會造成作業無法批改而沒有分數。
輸出格式
每次作業都有一定的輸出格式,請務必符合該次作業的輸出格式,輸出的答案必須在同一個字串上,特別注意答案以外的輸出一定要在繳交以前清除乾淨,以免造成批改作業上的誤判。
若作業規定輸入為java
,輸出為Avajay
,則最後只需要 print 出Avajay
即可。
請不要在答案的前後加上影響正確答案的輸出,例如 Answer=Avajay
,並且注意多餘的空白與換行符號都會影響答案的判斷。
提醒同學,批改作業用的測資會分成兩個部分,一部分是已經提供在作業說明的測試用測資,提供給同學測試自己的程式是否完成基本需求,完成基本需求的同學可以拿到基本分數;另一部分是檢查用測資,為用來批改同學作業的隱藏測資,所有測資皆在合理的考慮範圍之內,因此我們不會特別公開隱藏測資,更進一步的檢查需要由同學自行確認程式是否將所有可能的條件考慮周全。
作業提醒
以下為幾個以往繳交作業常出現的問題:
-
Output輸出格式不符合作業需求,請特別注意字串哪裡該換行或哪裡有空白字元等情況,並請不要印出不是答案的字串。
-
程式宣告了兩次以上的Scanner,作業需求通常都只要使用一個Scanner就好,請盡量避免使用兩次以上的狀況。
-
程式包含while(true)等造成無窮迴圈的寫法,我們不會特別幫你跳出程式。
-
程式或註解中包含中文卻沒有轉換環境編碼,請使用英文。
-
Input型態錯誤,Argument誤用成Scanner等情況。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
若之後批改之作業仍有上述的情況發生,恕不會給同學分數,請特別注意。常見的錯誤壓縮檔格式
請各位同學自行檢查你所上傳的作業是否遇到以下錯誤的壓縮檔格式:
- 錯誤範例1
壓縮檔內多帶一個有學號的資料夾
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 錯誤範例2
壓縮檔內多帶一個有學號的資料夾,且學號為小寫
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 錯誤範例3
帶有姓名的壓縮檔名
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 錯誤範例4
資料夾名稱不正確,應為 META-INF 而非 MANIFEST-INF
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 錯誤範例5
壓縮檔格式不正確,應為 zip 而非 rar
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 錯誤範例6
MANIFEST.MF
與 src 不符
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 錯誤範例7
程式碼中含有中文註解,造成編碼錯誤
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
若之後批改之作業仍有上述的情況發生,恕不會給同學分數,請特別注意。