-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fdf762
commit cdd1ef1
Showing
2 changed files
with
34 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export class ExamStats { | ||
export class Exam { | ||
// TODO | ||
} |
66 changes: 33 additions & 33 deletions
66
src/pages/exercises/object-exam/_codes/js/code/exam.print.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
import { ExamCheck } from "./exam-check.js"; | ||
import { ExamStats } from "./exam-stats.js"; | ||
import { Exam } from './exam.js'; | ||
|
||
// Exam Tool | ||
|
||
// calculating grade by weighted average | ||
let weight = { q1: 2, q2: 2, q3: 2, q4: 2, q5: 2 }; | ||
let answer = { q1: "a", q2: "b", q3: "a", q4: "c", q5: "d" }; | ||
let examCheck = new ExamCheck(answer, weight); | ||
const weight = { q1: 2, q2: 2, q3: 2, q4: 2, q5: 2 }; | ||
const answer = { q1: 'a', q2: 'b', q3: 'a', q4: 'c', q5: 'd' }; | ||
const exam = new Exam(answer, weight); | ||
|
||
let student = { q1: "a", q2: "b", q3: "b", q4: "b", q5: "b" }; | ||
console.log(examCheck.grade(student)); | ||
exam.add({ | ||
student: 'Alice', | ||
answer: { q1: 'a', q2: 'b', q3: 'b', q4: 'b', q5: 'b' }, | ||
}); | ||
|
||
console.log(exam.avg()); | ||
console.log(4); | ||
|
||
// calculating grade by weighted average | ||
weight = { q1: 2, q2: 2, q3: 2, q4: 2, q5: 2 }; | ||
answer = { q1: "a", q2: "b", q3: "a", q4: "c", q5: "d" }; | ||
examCheck = new ExamCheck(answer, weight); | ||
console.log(exam.min()); | ||
console.log([4]); | ||
|
||
console.log(exam.max()); | ||
console.log([4]); | ||
|
||
student = { q1: "c", q2: "b", q3: "a", q4: "c", q5: "d" }; | ||
console.log(examCheck.grade(student)); | ||
console.log(8); | ||
console.log(exam.lt(7)); | ||
console.log([4]); | ||
|
||
// calculating exam values | ||
let examStats = new ExamStats([ | ||
{ student: "Fulano", grade: 10 }, | ||
{ student: "Sicrano", grade: 5 }, | ||
{ student: "Beltrano", grade: 7 } | ||
]); | ||
console.log(exam.gt(7)); | ||
console.log([]); | ||
|
||
console.log(examStats.avg()); | ||
console.log(7.333333333333333); | ||
exam.add({ | ||
student: 'Bob', | ||
answer: { q1: 'c', q2: 'b', q3: 'a', q4: 'c', q5: 'd' }, | ||
}); | ||
|
||
console.log(examStats.min()); | ||
console.log([5]); | ||
console.log(exam.avg()); | ||
console.log(6); | ||
|
||
console.log(examStats.min(2)); | ||
console.log([5, 7]); | ||
console.log(exam.min()); | ||
console.log([4]); | ||
|
||
console.log(examStats.max()); | ||
console.log([10]); | ||
console.log(exam.max()); | ||
console.log([8]); | ||
|
||
console.log(examStats.lt(6)); | ||
console.log([5]); | ||
console.log(exam.lt(7)); | ||
console.log([4]); | ||
|
||
console.log(examStats.gt(6)); | ||
console.log([7, 10]); | ||
console.log(exam.gt(7)); | ||
console.log([8]); |