From f7f2da640a2c36de619d686aeec60b6784c15adf Mon Sep 17 00:00:00 2001 From: Noah-H3467 Date: Sun, 16 Feb 2025 20:25:14 -0500 Subject: [PATCH 1/4] HTML buttons --- index.html | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/index.html b/index.html index 33cd446..ca44022 100644 --- a/index.html +++ b/index.html @@ -12,25 +12,28 @@

Welcome to the N+N GPA Calculator!

- - - - + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + +
From fa7c5d98cc3a5ad37e359f8e845c85ce9473a818 Mon Sep 17 00:00:00 2001 From: Noah-H3467 Date: Mon, 17 Feb 2025 12:23:57 -0500 Subject: [PATCH 2/4] css + query selector --- index.html | 6 +++--- index.js | 28 ++++++++++++++++----------- style.css | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index ca44022..3b50680 100644 --- a/index.html +++ b/index.html @@ -39,14 +39,14 @@

Welcome to the N+N GPA Calculator!

-

+

This text will contain the feedback for the user

-

- This section will become visible once calculate GPA is pressed. It will display the GPAs. +

+

diff --git a/index.js b/index.js index 4f59001..0e3c437 100644 --- a/index.js +++ b/index.js @@ -92,6 +92,22 @@ class Ready { } } +const instructionText = document.querySelector("#instructionText"); +const gpaText = document.querySelector("#gpaText"); + +// Main stuff +let wGradePointList = [] +let gradePointList = [] +let creditsAggregation = 0; +let courseGrade; +let numCourses = 0; +let courseCredits = 0.0; +let courseWeight = null; +let courseRaw = 0; +let uGP; +uGP = 0.0; + + function promptUser() { numCourses += 1; canMoveOn = new Ready(false, false, false); @@ -157,16 +173,6 @@ function weighter(weight) { -// Main stuff -let wGradePointList = [] -let gradePointList = [] -let creditsAggregation = 0; -let courseGrade; -let numCourses = 0; -let courseCredits = 0.0; -let courseWeight = null; -let courseRaw = 0; -let uGP; -uGP = 0.0; + console.log("Welcome to the GPA Calculator with TKINTER.") promptUser() \ No newline at end of file diff --git a/style.css b/style.css index e69de29..031277f 100644 --- a/style.css +++ b/style.css @@ -0,0 +1,56 @@ +#body{ + margin: 0; + display: flex; + justify-content: center; /* horizontal alignment*/ + align-items: center; /*vertical alignment */ + height: 100vh; /* 100% of viewport height */ + background-color: hsl(0, 0%, 95%) +} +#calculator{ + font-family: Arial, sans-serif; + background-color:hsl(0, 0%, 15%); + border-radius: 15px; + max-width: 500px; + overflow: hidden; +} +#display{ + width: 100%; + padding: 20px; + font-size: 5rem; + text-align: left; + border: none; + background-color:hsl(0, 0%, 20%); + color: white +} +#keys{ + display: grid; + grid-template-columns: repeat(4, 1fr); /* each of four columns should take an even amount of space */ + gap: 10px; + padding: 25px; +} +button{ + width: 100px; + height: 100px; + border-radius: 50px; + border: none; + background-color: hsl(0, 0%, 30%); + color:cyan; + font-size: 4rem; + font-weight: bold; + cursor: pointer; +} +button:hover{ + background-color: hsl(0, 0%, 40%) +} +button:active{ + background-color: hsl(0, 0%, 50%) +} +.operator-btn{ + background-color: hsl(35, 100%, 55%); +} +.operator-btn:hover{ + background-color: hsl(35, 100%, 65%) +} +.operator-btn:active{ + background-color: hsl(35, 100%, 75%) +} \ No newline at end of file From f402b66a6ea4fdcc498149dfce5cee4012599e05 Mon Sep 17 00:00:00 2001 From: Noah-H3467 Date: Tue, 18 Feb 2025 15:15:14 -0500 Subject: [PATCH 3/4] Some debugging --- index.html | 25 ++++++++++++++++-------- index.js | 57 ++++++++++++++++++++++++++++++++++++++++++++---------- style.css | 4 ++-- 3 files changed, 66 insertions(+), 20 deletions(-) diff --git a/index.html b/index.html index 3b50680..7469e94 100644 --- a/index.html +++ b/index.html @@ -22,14 +22,14 @@

Welcome to the N+N GPA Calculator!

- - - - - - - - + + + + + + + + @@ -44,10 +44,19 @@

Welcome to the N+N GPA Calculator!

+
+

+

+

+
+

+

+ +

diff --git a/index.js b/index.js index 0e3c437..f64e491 100644 --- a/index.js +++ b/index.js @@ -93,7 +93,16 @@ class Ready { } const instructionText = document.querySelector("#instructionText"); -const gpaText = document.querySelector("#gpaText"); +const disp_Unweighted = document.querySelector("#gpaText"); +const disp_Weighted = document.querySelector("#wgpaText"); +const grades = document.querySelector("#gradesText"); +const weights = document.querySelector("#weightsText"); +const credits = document.querySelector("#creditsText"); +const instructions = document.querySelector("#instructionText"); + +// Calculation variables +let c_weighted; +let c_unweighted; // Main stuff let wGradePointList = [] @@ -106,6 +115,7 @@ let courseWeight = null; let courseRaw = 0; let uGP; uGP = 0.0; +let canMoveOn; function promptUser() { @@ -117,7 +127,7 @@ function promptUser() { console.log("If you are done entering information for that course, press DONE to move on."); console.log("Or, if you finished entering all your classes, press CALCULATE GPA. "); } - +// TODO: Debug function calculateGPA() { if (canMoveOn.isReady()) { creditsAggregation += courseCredits; @@ -147,32 +157,59 @@ function calculateGPA() { console.log(); console.log("Your weighted GPA is " + wGPA); console.log("Your unweighted GPA is " + uGPA); - disp_Weighted.set(wGPA.toString()); - disp_Unweighted.set(uGPA.toString()); + disp_Weighted.innerHTML = wGPA; + disp_Unweighted.innerHTML = uGPA; } } function grader(gradeDisp, wGradeRaw, uGradePoint) { - grades.set(gradeDisp); + grades.innerHTML = gradeDisp; courseRaw = wGradeRaw; uGP = uGradePoint; canMoveOn.setGrade(); } function crediter(credit) { - credits.set(credit); + credits.innerHTML = credit; courseCredits = credit; canMoveOn.setCredits(); } function weighter(weight) { - weights.set(weight); + weights.innerHTML = weight; courseWeight = weight; canMoveOn.setWeight(); } - - +function storeData() { + // global canMoveOn + // global creditsAggregation + // global courseCredits + // global c_weighted + // global c_unweighted + // global gradePointList + // global wGradePointList + if (canMoveOn.isReady()) { + creditsAggregation += courseCredits; + c_weighted = new Weighted(courseRaw, courseCredits, courseWeight); + c_weighted.addWeight(); + c_weighted.getGradePoint(); + c_weighted.GPtimesCredits(courseCredits); + wGradePointList.push(c_weighted.gradePoint); + c_unweighted = new Unweighted(uGP, courseCredits); + c_unweighted.GPtimesCredits(courseCredits); + gradePointList.push(c_unweighted.gradePoint); + c_weighted = null; + c_unweighted = null; + canMoveOn = null; + weights.innerHTML = ""; + credits.innerHTML = ""; + grades.innerHTML = ""; + promptUser(); + } else { + console.log("You must click all required buttons before moving on."); + } +} console.log("Welcome to the GPA Calculator with TKINTER.") -promptUser() \ No newline at end of file +promptUser(); \ No newline at end of file diff --git a/style.css b/style.css index 031277f..f390f7a 100644 --- a/style.css +++ b/style.css @@ -10,7 +10,7 @@ font-family: Arial, sans-serif; background-color:hsl(0, 0%, 15%); border-radius: 15px; - max-width: 500px; + max-width: 1000px; overflow: hidden; } #display{ @@ -29,7 +29,7 @@ padding: 25px; } button{ - width: 100px; + width: 200px; height: 100px; border-radius: 50px; border: none; From ce811153d9248ac90c3eda6c5f1877863eec0047 Mon Sep 17 00:00:00 2001 From: Noah-H3467 Date: Wed, 19 Feb 2025 09:04:15 -0500 Subject: [PATCH 4/4] Fix bugs - program technically works! --- calculator.py | 315 -------------------------------------------------- index.html | 18 ++- index.js | 83 ++++++------- 3 files changed, 50 insertions(+), 366 deletions(-) delete mode 100644 calculator.py diff --git a/calculator.py b/calculator.py deleted file mode 100644 index e58c949..0000000 --- a/calculator.py +++ /dev/null @@ -1,315 +0,0 @@ -import tkinter as tk -from tkinter import * -class Weighted: - def __init__(self, gradeRaw, credit, weight): - self.gradeRaw = gradeRaw - self.credit = credit - self.weight = weight - def addWeight(self): - if self.gradeRaw != 0: - if self.weight == "Honors": - self.gradeRaw += 1 - elif self.weight == "AP": - self.gradeRaw += 2 - def getGradePoint(self): - global GP - if self.gradeRaw == 14: - GP = 5 - elif self.gradeRaw == 13: - GP = 4.67 - elif self.gradeRaw == 12: - GP = 4.33 - elif self.gradeRaw == 11: - GP = 4 - elif self.gradeRaw == 10: - GP = 3.67 - elif self.gradeRaw == 9: - GP = 3.33 - elif self.gradeRaw == 8: - GP = 3 - elif self.gradeRaw == 7: - GP = 2.67 - elif self.gradeRaw == 6: - GP = 2.33 - elif self.gradeRaw == 5: - GP = 2 - elif self.gradeRaw == 4: - GP = 1.67 - elif self.gradeRaw == 3: - GP = 1.33 - elif self.gradeRaw == 2: - GP = 1.00 - elif self.gradeRaw == 1: - GP = 0.67 - else: - GP = 0 - def GPtimesCredits(self, credit): - self.gradePoint = GP * credit - return self.gradePoint -class Unweighted: - def __init__(self, uGP, credit): - self.credit = credit - self.uGP = uGP - def GPtimesCredits(self, credit): - self.gradePoint = self.uGP * credit - return self.gradePoint - -class Ready: - def __init__(self, isGrade, isWeight, isCredit): - self.grade = isGrade - self.weight = isWeight - self.credits = isCredit - self.isCalculated = False - - def setGrade(self): - self.grade = True - - def setWeight(self): - self.weight = True - - def setCredits(self): - self.credits = True - - def isReady(self): - return (self.grade and self.weight and self.credits) - - def setCalculated(self): - canMoveOn.isCalculated = True - -def promptUser(): - global numCourses - global canMoveOn - numCourses += 1 - canMoveOn = Ready(False, False, False) - print() - print("Class #" + str(numCourses) + ": ") - print("Use the bottons to enter the grade, number of credits, and Weight -'AP', 'Honors', 'Normal'- of your course.") - print("If you are done entering information for that course, press DONE to move on.") - print("Or, if you finished entering all your classes, press CALCULATE GPA. ") - -def calculateGPA(): - global wGradePointList - global creditsAggregation - global gradePointList - global canMoveOn - global disp_Weighted - global disp_Unweighted - - if (canMoveOn.isReady()): - creditsAggregation += courseCredits - c_weighted = Weighted(courseRaw, courseCredits, courseWeight) - c_weighted.addWeight() - c_weighted.getGradePoint() - c_weighted.GPtimesCredits(courseCredits) - wGradePointList.append(c_weighted.gradePoint) - c_unweighted = Unweighted(uGP, courseCredits) - c_unweighted.GPtimesCredits(courseCredits) - gradePointList.append(c_unweighted.gradePoint) - weights.set("") - credits.set("") - grades.set("") - wGradePointSum = 0.0 - uGradePointSum = 0.0 - for i in range(len(wGradePointList)): - wGradePointSum += wGradePointList[i] - wGPA = wGradePointSum/creditsAggregation - wGPA = round(wGPA*100)/100 - for i in range(numCourses): - uGradePointSum += gradePointList[i] - uGPA = uGradePointSum/creditsAggregation - uGPA = round(uGPA*100)/100 - print() - print("Your weighted GPA is " + str(wGPA)) - print("Your unweighted GPA is " + str(uGPA)) - disp_Weighted.set(str(wGPA)) - disp_Unweighted.set(str(uGPA)) - del wGPA - del uGPA - del c_weighted - del c_unweighted - -def grader(gradeDisp, wGradeRaw, uGradePoint): - global courseRaw - global uGP - global canMoveOn - grades.set(gradeDisp) - courseRaw = wGradeRaw - uGP = uGradePoint - canMoveOn.setGrade() - -def crediter(credit): - global courseCredits - global canMoveOn - credits.set(credit) - courseCredits = credit - canMoveOn.setCredits() - -def weighter(weight): - global courseWeight - global canMoveOn - weights.set(weight) - courseWeight = weight - canMoveOn.setWeight() - -def storeData(): - global canMoveOn - global creditsAggregation - global courseCredits - global c_weighted - global c_unweighted - global gradePointList - global wGradePointList - if canMoveOn.isReady(): - creditsAggregation += courseCredits - c_weighted = Weighted(courseRaw, courseCredits, courseWeight) - c_weighted.addWeight() - c_weighted.getGradePoint() - c_weighted.GPtimesCredits(courseCredits) - wGradePointList.append(c_weighted.gradePoint) - c_unweighted = Unweighted(uGP, courseCredits) - c_unweighted.GPtimesCredits(courseCredits) - gradePointList.append(c_unweighted.gradePoint) - del c_weighted - del c_unweighted - del canMoveOn - weights.set("") - credits.set("") - grades.set("") - promptUser() - else: - print("You must click all required buttons before moving on.") - -def reset(): - global canMoveOn - if canMoveOn.isCalculated: - global c_weighted - global c_unweighted - del c_weighted - del c_unweighted - del canMoveOn - global wGradePointList - global creditsAggregation - global gradePointList - global globe - weights.set("") - credits.set("") - grades.set("") - globe = '' - disp_Unweighted.set(globe) - disp_Weighted.set(globe) - wGradePointList = [] - gradePointList = [] - creditsAggregation = 0 - global courseGrade - global numCourses - numCourses = 0 - global courseCredits - courseCredits = 0 - global courseWeight - courseWeight = "null" - global courseRaw - courseRaw = 0 - global uGP - uGP = 0.0 - for line in range(5): - print() - print("Welcome to the GPA Calculator with TKINTER.") - promptUser() - -gpawindow = Tk() -gpawindow.title('GPA Calculator') -gpawindow.geometry('550x300') -topFrame = Frame(gpawindow) -topFrame.grid(rowspan = 5, columnspan = 10) -topFrame.configure(bg = "black") -grades = StringVar() -output = Entry(topFrame, width = 6, justify = CENTER, font = ('Arial', 16, 'bold'), textvariable = grades) -output.grid(row = 1, column = 7) - -credits = StringVar() -output = Entry(topFrame, width = 6, justify = CENTER, font = ('Arial', 16, 'bold'), textvariable = credits) -output.grid(row = 2, column = 7) - -weights = StringVar() -output = Entry(topFrame, width = 6, justify = CENTER, font = ('Arial', 16, 'bold'), textvariable = weights) -output.grid(row = 3, column = 7) - -disp_Weighted = StringVar() -output = Entry(topFrame, width = 5, justify = CENTER, font = ('Arial', 16, 'bold'), textvariable = disp_Weighted) -output.grid(row = 5, column = 2) - -disp_Unweighted = StringVar() -output = Entry(topFrame, width = 5, justify = CENTER, font = ('Arial', 16, 'bold'), textvariable = disp_Unweighted) -output.grid(row = 5, column = 3) - -aplus = Button(topFrame, text = 'A+', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('A+', 12, 4.0)) -aplus.grid(row = 1, column = 1) - -abutton = Button(topFrame, text = 'A', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('A', 11, 4.0)) -abutton.grid(row = 1, column = 2) - -aminus = Button(topFrame, text = 'A-', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('A-', 10, 3.67)) -aminus.grid(row = 1, column = 3) - -bplus = Button(topFrame, text = 'B+', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('B+', 9, 3.33)) -bplus.grid(row = 2, column = 1) - -bbutton = Button(topFrame, text = 'B', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('B', 8, 3.0)) -bbutton.grid(row = 2, column = 2) - -bminus = Button(topFrame, text = 'B-', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('B-', 7, 2.67)) -bminus.grid(row = 2, column = 3) - -cplus = Button(topFrame, text = 'C+', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('C+', 6, 2.33)) -cplus.grid(row = 3, column = 1) - -cbutton = Button(topFrame, text = 'C', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('C', 5, 2.0)) -cbutton.grid(row = 3, column = 2) - -cminus = Button(topFrame, text = 'C-', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('C-', 4, 1.67)) -cminus.grid(row = 3, column = 3) - -dplus = Button(topFrame, text = 'D+', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('D+', 3, 1.33)) -dplus.grid(row = 4, column = 1) -dbutton = Button(topFrame, text = 'D', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('D', 2, 1.00)) -dbutton.grid(row = 4, column = 2) -dminus = Button(topFrame, text = 'D-', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('D-', 1, 0.67)) -dminus.grid(row = 4, column = 3) -fbutton = Button(topFrame, text = 'F', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: grader('F', 0, 0.0)) -fbutton.grid(row = 4, column = 4) -twobutton = Button(topFrame, text = '2', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: crediter(2)) -twobutton.grid(row = 1, column = 4) -onebutton = Button(topFrame, text = '1', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: crediter(1)) -onebutton.grid(row = 2, column = 4) -halfbutton = Button(topFrame, text = '1/2', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: crediter(0.5)) -halfbutton.grid(row = 3, column = 4) -apbutton = Button(topFrame, text = 'AP', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: weighter('AP')) -apbutton.grid(row = 1, column = 5) -honorsbutton = Button(topFrame, text = 'Honors', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: weighter('Honors')) -honorsbutton.grid(row = 2, column = 5) -cpbutton = Button(topFrame, text = 'Normal', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: weighter('Normal')) -cpbutton.grid(row = 3, column = 5) -calcGPA = Button(topFrame,text = 'Calculate GPA', fg = 'white', bg = 'black', width = 10, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = lambda: calculateGPA()) -calcGPA.grid(row = 4, column = 7) -doneButton = Button(topFrame,text = 'Done', fg = 'white', bg = 'black', width = 4, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = storeData) -doneButton.grid(row = 4, column = 5) -restart = Button(topFrame,text = 'Restart', fg = 'white', bg = 'black', width = 10, height = 2, borderwidth = 5, font = ('Arial', 12, 'bold'), command = reset) -restart.grid(row = 5, column = 7) -weightedGPAlabel = tk.Label(text= 'Weighted', foreground = 'white', background = 'black', font=('Arial', 7, 'bold')) -unweightedGPAlabel = tk.Label(text= 'Unweighted', foreground = "white", background = 'black', font=('Arial', 7, 'bold', )) -weightedGPAlabel.grid(row = 4, column = 0) -unweightedGPAlabel.grid(row = 4, column = 4) -wGradePointList = [] -gradePointList = [] -creditsAggregation = 0 -global courseGrade -numCourses = 0 -courseCredits = 0 -courseWeight = "null" -global courseRaw -courseRaw = 0 -global uGP -uGP = 0.0 -print("Welcome to the GPA Calculator with TKINTER.") -promptUser() -gpawindow.mainloop() \ No newline at end of file diff --git a/index.html b/index.html index 7469e94..6dc93b4 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,12 @@ Main Page -

Welcome to the N+N GPA Calculator!

+

Welcome to the GPA Calculator with HTML!

+ +
+

+
+
@@ -38,12 +43,6 @@

Welcome to the N+N GPA Calculator!

-
-

- This text will contain the feedback for the user -

-
-

@@ -54,10 +53,9 @@

Welcome to the N+N GPA Calculator!

-

- -

+

+ \ No newline at end of file diff --git a/index.js b/index.js index f64e491..542a76f 100644 --- a/index.js +++ b/index.js @@ -90,42 +90,20 @@ class Ready { setCalculated() { this.isCalculated = true; } -} - -const instructionText = document.querySelector("#instructionText"); -const disp_Unweighted = document.querySelector("#gpaText"); -const disp_Weighted = document.querySelector("#wgpaText"); -const grades = document.querySelector("#gradesText"); -const weights = document.querySelector("#weightsText"); -const credits = document.querySelector("#creditsText"); -const instructions = document.querySelector("#instructionText"); - -// Calculation variables -let c_weighted; -let c_unweighted; - -// Main stuff -let wGradePointList = [] -let gradePointList = [] -let creditsAggregation = 0; -let courseGrade; -let numCourses = 0; -let courseCredits = 0.0; -let courseWeight = null; -let courseRaw = 0; -let uGP; -uGP = 0.0; -let canMoveOn; + reset() { + this.grade = false; + this.weight = false; + this.credits = false; + } +} function promptUser() { numCourses += 1; - canMoveOn = new Ready(false, false, false); - console.log(); - console.log("Class #" + numCourses + ": "); - console.log("Use the buttons to enter the grade, number of credits, and Weight -'AP', 'Honors', 'Normal'- of your course."); - console.log("If you are done entering information for that course, press DONE to move on."); - console.log("Or, if you finished entering all your classes, press CALCULATE GPA. "); + instructionText.innerHTML = "Class #" + numCourses + ": "; + instructionText.innerHTML += " Use the buttons to enter the grade, number of credits, and Weight -'AP', 'Honors', 'Normal'- of your course."; + instructionText.innerHTML += " If you are done entering information for that course, press DONE to move on."; + instructionText.innerHTML += " Or, if you finished entering all your classes, press CALCULATE GPA. "; } // TODO: Debug function calculateGPA() { @@ -139,9 +117,9 @@ function calculateGPA() { let c_unweighted = new Unweighted(uGP, courseCredits); c_unweighted.GPtimesCredits(courseCredits); gradePointList.push(c_unweighted.gradePoint); - weights.set(""); - credits.set(""); - grades.set(""); + weights.innerHTML = ""; + credits.innerHTML = ""; + grades.innerHTML = ""; let wGradePointSum = 0.0; let uGradePointSum = 0.0; for (let i = 0; i < wGradePointList.length; i++) { @@ -154,9 +132,8 @@ function calculateGPA() { } let uGPA = uGradePointSum / creditsAggregation; uGPA = Math.round(uGPA * 100) / 100; - console.log(); - console.log("Your weighted GPA is " + wGPA); - console.log("Your unweighted GPA is " + uGPA); + instructionText.innerHTML = "Your weighted GPA is " + wGPA + "."; + instructionText.innerHTML += " Your unweighted GPA is " + uGPA + "."; disp_Weighted.innerHTML = wGPA; disp_Unweighted.innerHTML = uGPA; } @@ -201,15 +178,39 @@ function storeData() { gradePointList.push(c_unweighted.gradePoint); c_weighted = null; c_unweighted = null; - canMoveOn = null; + canMoveOn.reset(); weights.innerHTML = ""; credits.innerHTML = ""; grades.innerHTML = ""; promptUser(); } else { - console.log("You must click all required buttons before moving on."); + instructionText += " You must click all required buttons before moving on."; } } -console.log("Welcome to the GPA Calculator with TKINTER.") +const instructionText = document.querySelector("#instructionText"); +const disp_Unweighted = document.querySelector("#gpaText"); +const disp_Weighted = document.querySelector("#wgpaText"); +const grades = document.querySelector("#gradesText"); +const weights = document.querySelector("#weightsText"); +const credits = document.querySelector("#creditsText"); +const instructions = document.querySelector("#instructionText"); + +// Calculation variables +let c_weighted; +let c_unweighted; + +// Main stuff +let wGradePointList = [] +let gradePointList = [] +let creditsAggregation = 0; +let courseGrade; +let numCourses = 0; +let courseCredits = 0.0; +let courseWeight = null; +let courseRaw = 0; +let uGP; +uGP = 0.0; +let canMoveOn = new Ready(false, false, false) + promptUser(); \ No newline at end of file