$30
Assignment No. 4
EECS 368
Programming Language Paradigms
Deliverables:
1. Copy of Rubric4.docx with your name and ID filled out (do not submit a PDF)
2. HTML file named: PieChart.htm
3. The grader will execute your HTML file to ensure it runs.
Assignment:
• In Chapter 17, we saw an example program that drew a pie chart.
• Modify this program so that the name of each category is shown next to the slice
that represents it.
• Try to find a pleasing-looking way to automatically position this text that would
work for other data sets as well.
• You may assume that categories are big enough to leave ample room for their
labels.
• You might need Math.sin and Math.cos again, which are described in Chapter 14.
• Draw the chart twice.
• Once with this customer satisfaction data (data set 1):
o 927 of the customers answered “Satisfied”
o 463 of the customers answered “Neutral”
o 213 of the customers answered “Unsatisfied”
o 510 of the customers answered “No comment”
• Once with this customer satisfaction data (data set 2):
o 104 of the customers answered “Very happy
o 63 of the customers answered “Happy”
o 87 of the customers answered “Neutral”
o 51 of the customers answered “Unhappy”
o 26 of the customers answered “Very unhappy”
o 18 of the customers answered “No comment”
• You may choose your own colors for each pie slice
• Include all your code in a single HTML file named PieChart.htm
• Your code must display both pie charts when the grader clicks on PieChart.htm
• Provide comments for the JavaScript code that explain what each line of code is
doing. See rubric below. You do not have to comment the HTML code.
Rubric for Program Comments
Exceeds Expectations
(90-100%)
Meets Expectations
(80-89%)
Unsatisfactory
(0-79%)
Software is adequately
commented with prologue
comments, comments
summarizing major blocks of
code, and comments on every
line.
Prologue comments are present
but missing some items or some
major blocks of code are not
commented or there are
inadequate comments on each
line.
Prologue comments are missing
all together or there are no
comments on major blocks of
code or there are very few
comments on each line.
Adequate Prologue Comments:
• Name of program contained in the file (e.g., EECS 368 Assignment 3)
• Brief description of the program, e.g.:
o Simple tabbed interface using JavaScript and HTML
• Inputs (e.g., none, for a function, it would be the parameters passed to it)
• Output, e.g.,
o Browser window with 3 tabs and text
• Author’s full name
• Creation date: The date you first create the file, i.e., the date you write this
comment
Adequate comments summarizing major blocks of code and comments on every line:
• Provide comments that explain what each line of code is doing.
• You may comment each line of code (e.g., using //) and/or provide a multi-line
comment (e.g., using /* and */) that explains what a group of lines does.
• Multi-line comments should be detailed enough that it is clear what each line of
code is doing.
Remember:
• Your Programming Assignments are individual-effort.
• You can brainstorm with other students and help them work through problems in
their programs, but everyone should have their own unique assignment programs.