Question
1. Create a data file data/studentList.js . Create a global array called studentList and populate it with 5 example students, each array element having an
1. Create a data file data/studentList.js . Create a global array called studentList and populate it with 5 example students, each array element having an object for the students data, containing:
{ name: "student name goes here", sid: 12345678, wam: 64.5
}
Create a function called displayStudentTable(). The purpose of this function is to create a TABLE element, with 3 columns: SID, Name, WAM (as a header row). You are then to add a new row element for every student in studentList, and to fill each column (TD) as appropriate.
Create a 4th column Grade. This column is not stored in the studentList data, but is auto-calculated based on the WAM. You will write text in this column: Fail, Pass, Credit, Distinction, High Distinction, based on each students WAM score.
Depending on the grade of the user, assign a background colour for the entire row of red if the student is failing, otherwise green.
Create one final row, with only the WAM field having data, the rest being empty. Make this field the average value of all students WAM scores. Note: to calculate the average, simply keep a sum of all WAM scores (start the sum at 0, and add to it for each student), then at the end, divide this sum by the number of students (the length of the studentList).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started