Description
Overview
This assignment has you get a taste for Javascript programming that runs in a web browser. It is a low impact assignment that is meant as a warm-up Make an attempt this weekend and come to class with questions on Monday. I’ll set up a gradescope course with a Project 0 assignment where you can submit your code and documentation.
The starting code for this assignment can be downloaded here. It includes a web page primes.html
that relies on the Javascript file primes.js
, is-prime.html
that relies on the Javascript file is-prime.js
, and a web page triangle.html
that relies on triangle.js
and gl-matrix-min.js
.
Exercise: divisors
Mimicking what you see in the primes
and is-prime
code, create a web application that allows its user to input a positive integer and to then produce an alert that outputs the positive divisors of that integer.
The alert should output text like:
The divisors of 17 are 1 and 17.
in the case the input is prime and
The divisors of 12 are 1, 3, 4, and 12.
in the case that the input is composite.
Exercise: triangles
Mimicking what you see in the triangle
code, create a web application that has a button populate
that places an additional randomly placed triangle onto the canvas. All of the placed triangles should be displayed (so you’ll want to keep them in a Javascript array), but only the last placed one should get edited by the other buttons of the application.
Submitting your work
Upload your source files (including all supporting files) up to gradescope by Tuesday. Please include every file that is needed to run each application. I’ll want to download these files and run your demo, and if you hand in all the individual files, they get packaged as a folder for me by Gradescope. By handing in the files individually (rather than as an archive file or a ZIP), I can comment on individual lines of your code within Gradescope.
You should also include a brief text file, either named submitted.md
or submitted.txt
, that describes the work that you did, how you did it, whether it is working, what isn’t working, and any extra things that you want to tell me about that you did or had planned to do.
Please hand in what you have completed by the deadline, even if you haven’t completed everything or the code isn’t working. We’ll go through solutions in class in lecture on Tuesday.