返回列表 發帖

Java 206 關鍵字出現次數

本帖最後由 鄭繼威 於 2023-9-9 10:17 編輯

1. 題目說明:
請開啟C:\ANS.CSF\JP02資料夾中的JPD02.java進行編寫。依下列題意進行作答:在指定字串中尋找關鍵字,計算此字串出現次數後輸出,使輸出值符合題意要求。檔案名稱請另存新檔為JPA02.java,儲存於C:\ANS.CSF\JP02資料夾,再進行評分。

2. 設計說明:
(1) 請撰寫程式,讓使用者輸入一個字串,尋找並計算此字串於常數dreams短文中出現的次數,輸出次數。

3. 輸入輸出:
輸入說明
一個字串

輸出說明
字串出現次數(輸出最後一行後不自動換行)

final String dreams = "There are moments in life when you miss someone so much that "
                                + "you just want to pick them from your dreams and hug them for real! Dream what "
                                + "you want to dream; go where you want to go; be what you want to be, because you have "
                                + "only one life and one chance to do all the things you want to do";

範例輸入1
to do

範例輸出1
2

範例輸入2
when yu miss

範例輸出2
0
java17-206.docx
本帖隱藏的內容需要回復才可以瀏覽

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

返回列表