Assignment 4
Using a class and displaying array elements
Due Saturday October 5 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 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.

General Requirements

In addition to the requirements above, your submission should have the following:

  • A written overview (approximately 1 paragraph) that describes your accomplishment and how you accomplished it --- include any details of help, collaboration, or use of online resources. Include how your work addresses the project requirements.
  • Your name and app description commented in the html and js files.
  • Consistent indentation for html and JavaScript.
  • Good use of variable declarations and assignments (as shown in class)

Submission

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

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

The submitted file should include all files for your app to run successfully. Be sure to test it before submitting!

Grading

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