-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.js
More file actions
36 lines (32 loc) · 1.07 KB
/
data.js
File metadata and controls
36 lines (32 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var colleges = new Map();
fetch("data.csv")
.then((res) => res.text())
.then((text) => {
console.log("Success");
console.log(text);
})
.catch((e) => console.error(e));
colleges.set("University of Toledo", {"Acceptance Rate": 90, "Median SAT": 1200, "School Size": 2000, "Competitive Sports": 1});
colleges.set("Stanford", {"Acceptance Rate": 3, "Median SAT": 1560, "School Size": 4000, "Competitive Sports": 6});
colleges.set("Ohio State", {"Acceptance Rate": 40, "Median SAT": 1400, "School Size": 30000, "Competitive Sports": 9});
/**
* @returns The map containing all colleges and their attributes
*/
function getColleges() {
return colleges;
}
/**
* @param {String} currentWeight
* @returns A multiplier that causes almost all schools to fall on a 0-10 scale for this attribute
*/
function getWeightMultiplier(currentWeight) {
switch (currentWeight) {
case "Acceptance Rate":
return 1/10;
case "Median SAT":
return 4*10/1600;
case "School Size":
return 10/30000;
}
return 1;
}