DATABASE AND TİMİNG

- - - - - - - - BİRİNCİ KISIM - - - - - - - -

→ Exam Schedule For a Given Student ←

→ Student List Taking a Given Course ←

→ Course List For a Given Exam Room ←

→ Total Courses In a Given Room ←

→ Course List For a Given Date ←EKSTRA

- - - - - - - - İKİNCİ KISIM - - - - - - - -

→ Result


Sample code
class Course {
constructor(id,time,date,...list) {
if(!id) throw "Undefined Course id"
this.id = id;
this.time = time;
this.date = date;
this.list = list;
}
toString() {
return this.id+' '+' '+this.time+' '+this.date;
}
static fromString(s) {
return new Course(...s.split('\t'));
}
}
function readCourses() {
fetch(LINK+"Courses.txt").then(r => r.text())
.then(t => makeData(t, Course, crsMap))
}
function findBest() { //the best gpa in stdMap
let bestgGpa = 0
for (let b of stdMap.values()){
if(b.gpa > bestgGpa){
bestgGpa = b.gpa
}
}
report(bestgGpa);
}
function student_List_Taking_Given_Course(){
let value = document.getElementById("txt_second").value.toUpperCase();
let counter = 0;
for(let student of stdMap.values()){
if(student.list.includes(value)){
counter++;
if(counter==1) report("Bu Dersi Alan Öğrenciler :");
report("ID : "+student.id+" Adı : "+student.name+" Gpa : "+student.gpa);
}
}

}
function course_List_Given_Exam_Room(){
let value = document.getElementById("txt_third").value.toUpperCase();
let counter = 0;
for(let course of crsMap.values()){
if(course.list.includes(value)){
counter++;
if(counter==1) report("Bu Sınıfta Sınavı Olacak Dersler :");
report("Ders Kodu : "+course.id+" Tarihi : "+course.date+" Saati :"+course.time);
}
}
}
function total_Courses_Given_Room(){
let counter = 0;
let value = document.getElementById("txt_fourth").value.toUpperCase();
for(let courses of crsMap.values()){
if(courses.list.includes(value)){
counter++;
}
}
if(counter == 0){
report("Bu sınıfta ders yoktur");
}else{
report("Bu sınıfta verilen toplam ders sayısı : "+counter);
}
}
function course_List_Given_Date(){
let value = document.getElementById("txt_fifth").value.toUpperCase();
let counter = 0;
for(let courses of crsMap.values()){
if(courses.date == value){
counter++;
if(counter==1) report("Girilen Tarihte Sınavı Olacak Dersler :");
report("Ders Kodu : "+courses.id+" Tarihi : "+courses.date+" Saati :"+courses.time);
}
}
}
function data_Sets_Comparison(){
let student_ID = 116690070;
let has = 0;
let include = 0;
let keys = [];
for (let number of stdMap) {
keys.push(number[0])
}
let has_Time = Date.now();
for (let index=student_ID; index<student_ID+10000; index++) {
if(stdMap.has(index.toString())){
has+=1;
}
}
has_Time = Date.now() - has_Time;
let includeTime = Date.now()
for (let index=student_ID; index<student_ID+10000; index++) {
if(keys.includes(index.toString())){
include+=1;
}
}
includeTime = Date.now() - includeTime;
report("<hr>");
report("has metodu ile çıkan sonuç : "+has)
report("Include metodu ile çıkan sonuç : "+include)
report("has metodu ile algortima zamanı : "+has_Time)
report("Include metodu ile alogirtma zamanı : "+includeTime)
report("</hr>");

}