Make a One-Button Stopwatch
Notice how the JavaScript and Java code shown in One-Button Stopwatch is partitioned. Using a text editor, place the code snippets into separate files. Name the files and place the files in particular directories as suggested by the headers above each section of code and as described below.
If you're working with the JavaScript code, all of the files should be placed in a single directory and should have the same name as the header above the section of code. Load the Stopwatch.html file using a web browser.
If you're working with the Java code, then the file named Stopwatch.java should be placed in a directory that contains a directory named com; the com directory should contain a directory named blogspot; and the blogspot directory should contain a directory named finnegantakes. The other .java files should be placed in the finnegantakes directory. Compile all of the .java files and interpret the Stopwatch class.
Recommended Reading
AP Computer Science Principles - JavaScript
- JavaScript: The Definitive Guide, 6th Edition by David Flanagan
- Scripts in External Files (pp. 313-314)
- Mozilla Developer Network: <script> - HTML
- Barron's AP Computer Science A, 7th Edition by Roselyn Teukolsky
- Packages and Classes (pp. 57-58)
- Wikipedia: Java package
- AP Computer Science A Course Description
- Language Features and other Testable Topics - packages (p. 64)