> For the complete documentation index, see [llms.txt](https://cmmobile.gitbook.io/cmmobilebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cmmobile.gitbook.io/cmmobilebook/cheng-shi-lian-xi-ti/wu-jian-dao-xiang-lian-xi/stopwatch.md).

# StopWatch

### 題目一

請設計一個名為StopWatch的類別。此類別包括：

* 資料欄位有startTime與endTime，並且外部只能get，不能set。
* 產生StopWatch時，建構式有製造時間manufacturingDate，以目前時間當作參數。
* 名為start()的方法，用來將startTime重新設定為目前時間。
* 名為stop()的方法，用來將endTime設定為目前時間。
* 名為getElapsedTime()的方法，回傳碼表所經過，以毫秒為單位的時間。

產生100,000個隨機數計，並且做排序由小到大。利用StopWatch類別來計算所需的時間和製造時間，並顯示結果。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cmmobile.gitbook.io/cmmobilebook/cheng-shi-lian-xi-ti/wu-jian-dao-xiang-lian-xi/stopwatch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
