Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Here's the code provided for the question: var courseGrade; //Assessment object function Assessment(name, type, maxPoint) { this.name = name; this.type = type; this.maxPoints = maxPoint;

Here's the code provided for the question:

var courseGrade; //Assessment object function Assessment(name, type, maxPoint) { this.name = name; this.type = type; this.maxPoints = maxPoint; this.earnedPoints = 0; } function CourseGrade() { this.grades = []; this.grades.push(new Assessment("exam1","exam","100")); this.grades.push(new Assessment("lab1","lab","25")); this.grades.push(new Assessment("lab2","lab","25")); } function initialize() { courseGrade = new CourseGrade(); } function getArrayIndex(assessmentName) { for (var i=0; i < courseGrade.grades.length; i++) { if (courseGrade.grades[i].name == assessmentName) { return i; } } } function buttonPressed() { courseGrade.grades[getArrayIndex("lab1")].earnedPoints = lab1textbox ; }

---------------------------------------------------

Here is the question itself:

Tasks:

Rewrite the grade calculator HTML page such that it uses objects, and retains the object data using cookies please use the HTML you created in Lab 02. You can implement a Save button to store the assignment data in the cookie. Make sure you have a way to demonstrate that the data is actually saved to the cookie. How? Can you populate the data on the HTML page from whats stored in the cookie? In your lab report, clearly demo how you implement this requirement using cookie.

Each assessment (a lab, quiz, exam, participation, and so forth) can be modeled as an Assessment (JavaScript) object whose class diagram is shown on the right. You should use array(s) to group the assessments into a single object (for example Grades). This object can include grade calculations. A single top-level object can facilitate storing data into the cookie.

One tip: if an Assessments name is the same as the id of the corresponding textbox, your (coding) life can be easier.

Given that the cookie does not accept native JavaScript object, you should convert the JavaScript object to a JSON string before saving it to the cookie. The same is true before you populate the data to the HTML page from the cookie data. This time, you need to convert the cookie data (JSON) string back to a JavaScript object.

You should have a separate css file for any styles you need for this app, and a separate js file for JavaScript.

Please follow good coding styles, and adopt meaningful names and good naming conventions. Also, avoid and minimize hardcoding in your app.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions