Assignment 4
Using a class and displaying array elements
Due Saturday October 11 before 11:30pm

Overview

For this assignment, you will use a JavaScript class for displaying results that are returned from its methods, including an array of elements.

Background

Twister is game that uses a spinner that randomly produces four colors. For this assignment, you will use a class that produces results from the spinner. In addition to showing the randomly selected color, you will use the class to produce the most frequently spun color and give the user the option to display the whole history of spins. Your focus is how the results are displayed since the class methods do the production of the results for you.

Start Up

Download the spinner folder (correct V2 version) and study the code in the files. The files produce a simple demo where the user can run a spinner and the selected color is presented.

Experiment with the demo files to help you understand how they work.

Try out the Spinner class in the console to see how the methods work

Project Requirements

Using the demo as a starting point, modify the code so that it accomplishes the following:

  • Presents the most frequent color in addition to the random color for the current spin
  • The spin count is displayed and updated with each spin.
  • Upon the user's request, the history of all spun colors are displayed.
  • Upon the user's request, the spinner is reset, erasing all history and returning the spin count to 0.

While not required for full credit, there are opportunities to expand on the requirements. Consider presenting the results in the specified color. More advanced: allow the user to create a custom spinner by allowing them to specify the colors that the spinner can produce.

Requirements

Your interactive page should have the following:

  • Your name and app description commented in the html and js files.
  • Consistent indentation for html and JavaScript.
  • Use of code constructs consistent with those presented in class

The submission should also include a written overview (less than one page) that describes your accomplishment and how you accomplished it --- include any details of help, collaboration, or use of online resources.

Submission

On D2L, submit a zip file of a folder with the following contents:

  • A readable document (pdf) that summarizes your accomplishment.
  • html file
  • JS file
  • Any supplementary files for your web app

Grading

This assignment is worth 10 points. A rubric will be provided with the submission.