This is a real, former exercise from the course “Computing Applications”
Open the exercise template clock.html (exercises/clock/clock.html) and
for example, read the hours as an integer in the following way:
var pvm = new Date();
var hours = pvm.getHours();
You can read minutes and seconds by methods getMinutes and getSeconds(),
NOTE! At this point, the clock does not need to work correctly with numbers
less than ten. (See part 4.)
string and a string with an integer. The integer is automatically converted
into a string and the result is a string. Example:
"ABC" + "1" + 23 ==> "ABC123"
Calling a function repeatedly
If you replace the function call func_name() with function
func_name() repeatedly with intervals. The time is in milliseconds.
You will notice that the clock does not still work quite right. If a number is
less than ten, the leading zero is not shown, because the times are integers.
Hint: a % b computes a division remainder. See also: arithmetic
a % b
A+ presents the exercise submission form here.
The model solution fto this exercise is in the aplus-manual directory
The exercise files are in the directory exercises/clock/.
The grader uses Python and Graderutils, just like described in the
Instructions. Essentially, it uses Selenium and the related Python package to run the tests. This means that it
starts a web browser which actually renders the web page and runs the
config.yaml uses apluslms/grading-python-web as the grading container.