diff --git a/.classpath b/.classpath
index defbd0a..d321106 100644
--- a/.classpath
+++ b/.classpath
@@ -10,6 +10,5 @@
-
diff --git a/ClassDiagram.ucls b/ClassDiagram.ucls
new file mode 100644
index 0000000..2e740c8
--- /dev/null
+++ b/ClassDiagram.ucls
@@ -0,0 +1,236 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bin/comm/Connector.class b/bin/comm/Connector.class
index 5c70ebe..739e6da 100644
Binary files a/bin/comm/Connector.class and b/bin/comm/Connector.class differ
diff --git a/bin/comm/DataBase.class b/bin/comm/DataBase.class
index 60abf81..847d409 100644
Binary files a/bin/comm/DataBase.class and b/bin/comm/DataBase.class differ
diff --git a/bin/comm/EmailComm$1.class b/bin/comm/EmailComm$1.class
index 3dcec80..ff88fed 100644
Binary files a/bin/comm/EmailComm$1.class and b/bin/comm/EmailComm$1.class differ
diff --git a/bin/comm/EmailComm.class b/bin/comm/EmailComm.class
index 2fe3a9b..8b22655 100644
Binary files a/bin/comm/EmailComm.class and b/bin/comm/EmailComm.class differ
diff --git a/bin/gui/HelpPage.class b/bin/gui/HelpPage.class
index aeba45f..ec3d578 100644
Binary files a/bin/gui/HelpPage.class and b/bin/gui/HelpPage.class differ
diff --git a/bin/gui/LoginPage.class b/bin/gui/LoginPage.class
index 6688654..52ea925 100644
Binary files a/bin/gui/LoginPage.class and b/bin/gui/LoginPage.class differ
diff --git a/bin/gui/ProfessorGUI$1.class b/bin/gui/ProfessorGUI$1.class
index b071010..7c62773 100644
Binary files a/bin/gui/ProfessorGUI$1.class and b/bin/gui/ProfessorGUI$1.class differ
diff --git a/bin/gui/ProfessorGUI$2.class b/bin/gui/ProfessorGUI$2.class
index 89b519a..bfbb810 100644
Binary files a/bin/gui/ProfessorGUI$2.class and b/bin/gui/ProfessorGUI$2.class differ
diff --git a/bin/gui/ProfessorGUI$3.class b/bin/gui/ProfessorGUI$3.class
index 5fb08ce..a8e55e4 100644
Binary files a/bin/gui/ProfessorGUI$3.class and b/bin/gui/ProfessorGUI$3.class differ
diff --git a/bin/gui/ProfessorGUI$4.class b/bin/gui/ProfessorGUI$4.class
index 2e1dab9..d73fcbd 100644
Binary files a/bin/gui/ProfessorGUI$4.class and b/bin/gui/ProfessorGUI$4.class differ
diff --git a/bin/gui/ProfessorGUI$5.class b/bin/gui/ProfessorGUI$5.class
index 0f1bc50..24c2b3f 100644
Binary files a/bin/gui/ProfessorGUI$5.class and b/bin/gui/ProfessorGUI$5.class differ
diff --git a/bin/gui/ProfessorGUI$6.class b/bin/gui/ProfessorGUI$6.class
index 5774f07..d7cedd5 100644
Binary files a/bin/gui/ProfessorGUI$6.class and b/bin/gui/ProfessorGUI$6.class differ
diff --git a/bin/gui/ProfessorGUI$7.class b/bin/gui/ProfessorGUI$7.class
index ad7acaf..c3c8575 100644
Binary files a/bin/gui/ProfessorGUI$7.class and b/bin/gui/ProfessorGUI$7.class differ
diff --git a/bin/gui/ProfessorGUI.class b/bin/gui/ProfessorGUI.class
index d12cda6..eb07303 100644
Binary files a/bin/gui/ProfessorGUI.class and b/bin/gui/ProfessorGUI.class differ
diff --git a/bin/gui/Question.class b/bin/gui/Question.class
index 4947bd1..5bc121f 100644
Binary files a/bin/gui/Question.class and b/bin/gui/Question.class differ
diff --git a/bin/gui/QuestionPages.class b/bin/gui/QuestionPages.class
index c4ecc96..0aef357 100644
Binary files a/bin/gui/QuestionPages.class and b/bin/gui/QuestionPages.class differ
diff --git a/bin/gui/Quiz$1.class b/bin/gui/Quiz$1.class
index 1ad115c..76c9b0b 100644
Binary files a/bin/gui/Quiz$1.class and b/bin/gui/Quiz$1.class differ
diff --git a/bin/gui/Quiz$2.class b/bin/gui/Quiz$2.class
index 4ad51d1..385dd78 100644
Binary files a/bin/gui/Quiz$2.class and b/bin/gui/Quiz$2.class differ
diff --git a/bin/gui/Quiz.class b/bin/gui/Quiz.class
index 2b2c2f2..879dbb5 100644
Binary files a/bin/gui/Quiz.class and b/bin/gui/Quiz.class differ
diff --git a/bin/gui/SendPage.class b/bin/gui/SendPage.class
index 56bd066..6d88cc9 100644
Binary files a/bin/gui/SendPage.class and b/bin/gui/SendPage.class differ
diff --git a/bin/gui/StartPage.class b/bin/gui/StartPage.class
index e21d018..4fc17d2 100644
Binary files a/bin/gui/StartPage.class and b/bin/gui/StartPage.class differ
diff --git a/bin/gui/Styles.class b/bin/gui/Styles.class
index 3c79729..b3cc5ad 100644
Binary files a/bin/gui/Styles.class and b/bin/gui/Styles.class differ
diff --git a/bin/gui/VerificationPage$1.class b/bin/gui/VerificationPage$1.class
index 3921cbe..b2516bc 100644
Binary files a/bin/gui/VerificationPage$1.class and b/bin/gui/VerificationPage$1.class differ
diff --git a/bin/gui/VerificationPage.class b/bin/gui/VerificationPage.class
index 6d9b90c..5cd7eb3 100644
Binary files a/bin/gui/VerificationPage.class and b/bin/gui/VerificationPage.class differ
diff --git a/bin/gui/gradeReport.class b/bin/gui/gradeReport.class
index 1588f5b..b36cd58 100644
Binary files a/bin/gui/gradeReport.class and b/bin/gui/gradeReport.class differ
diff --git a/src/comm/Connector.java b/src/comm/Connector.java
index d0e4627..4fa4bff 100644
--- a/src/comm/Connector.java
+++ b/src/comm/Connector.java
@@ -2,13 +2,14 @@
import java.sql.Connection;
import java.sql.DriverManager;
+import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Connector {
- private Connection connect;
+ public static Connection connect;
private Statement statment;
private ResultSet resultSet;
@@ -39,7 +40,7 @@ public Connector(String por, String db, String usr, String pass) {
this.user = usr;
this.password = pass;
}
-
+
public int connect() {
try {
Class.forName("org.postgresql.Driver");
diff --git a/src/gui/InsertIntoQQ.java b/src/gui/InsertIntoQQ.java
new file mode 100644
index 0000000..5ff6147
--- /dev/null
+++ b/src/gui/InsertIntoQQ.java
@@ -0,0 +1,36 @@
+package gui;
+
+import java.sql.Array;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+
+import comm.Connector;
+import comm.DataBase;
+
+public class InsertIntoQQ {
+ public static DataBase db = new DataBase();
+
+ public static void main(String[] args) {
+ try {
+ System.out.println("here1");
+ String bleh[] = {"d", "b", "c"};
+ String quizName = "testquiz";
+ String sql = "INSERT INTO " + quizName + " VALUES (?, ?, ?);";
+
+ Connector conn = new Connector();
+ conn.connect();
+ Array arrBleh = Connector.connect.createArrayOf("text", bleh);
+ PreparedStatement p = Connector.connect.prepareStatement(sql);
+ p.setString(1, "abc@gmail.com"); // Change to email value once stored
+ p.setArray(2, arrBleh); //Name of array
+ p.setInt(3, 80); //Final grade once calculated
+ p.executeUpdate();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+
+ }
+
+}
diff --git a/src/gui/ProfessorGUI.java b/src/gui/ProfessorGUI.java
index cc7908a..91daae9 100644
--- a/src/gui/ProfessorGUI.java
+++ b/src/gui/ProfessorGUI.java
@@ -18,6 +18,7 @@
public class ProfessorGUI extends Application {
+ private String fileName;
private DataBase dataBase = new DataBase();
private String emailList = "";
@@ -116,7 +117,7 @@ public void handle(ActionEvent arg0) {
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Text Files", "*.txt"));
//Remove the .txt from file name
- String fileName = startPage.getLblEFile().getText();
+ fileName = startPage.getLblQFile().getText();
fileName = fileName.substring(0, fileName.length()-4);
//call create report
@@ -206,10 +207,18 @@ public void handle(ActionEvent event) {
eCom.sendEmails(vPage.getEmailField().getText(), vPage.getPassField().getText(), "This is a test",
"This is a test for our Project", emailList);
- dataBase.Write("CREATE TABLE public.\"" + questionList.getName() + "\"" + "("
+ fileName = startPage.getLblQFile().getText();
+ fileName = fileName.substring(0, fileName.length()-4);
+
+ dataBase.Write("CREATE TABLE public.\"" + fileName + "\"" + "("
+ "\"studentEmail\" text COLLATE pg_catalog.\"default\","
+ "responses text[] COLLATE pg_catalog.\"default\"," + "\"finalGrade\" double precision" + ")"
- + "WITH (" + "OIDS = FALSE)" + "TABLESPACE pg_default;");
+ + "WITH (" + "OIDS = FALSE)" + "TABLESPACE pg_default;" + " " + "INSERT INTO " + "\"QuizCodes\" VALUES ('" + fileName +
+ "', " + sendPage.getQuizCode().getText() + ");" +
+ " CREATE TABLE public.\"" + fileName + "questions\"" + "("
+ + "\"questions\" text COLLATE pg_catalog.\"default\","
+ + "canswers text COLLATE pg_catalog.\"default\"," + "\"panswers\" text[]" + ")"
+ + "WITH (" + "OIDS = FALSE)" + "TABLESPACE pg_default;");
}
});
diff --git a/src/gui/QuestionPages.java b/src/gui/QuestionPages.java
index b2b34b8..93af027 100644
--- a/src/gui/QuestionPages.java
+++ b/src/gui/QuestionPages.java
@@ -4,6 +4,10 @@
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
+
+import comm.DataBase;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.effect.DropShadow;
@@ -15,6 +19,7 @@
public class QuestionPages {
+ private DataBase db = new DataBase();
//use file to generate questions and answers
File txtQuestions = new File("src/questions.txt");
@@ -69,7 +74,13 @@ public QuestionPages() {
btnNext.setStyle(buttonStyle);
btnNext.setOnMouseEntered(e -> btnNext.setStyle(buttonHoverStyle));
btnNext.setOnMouseExited(e -> btnNext.setStyle(buttonStyle));
-
+
+ ArrayList bleh = new ArrayList<>();
+ bleh.add("a");
+ bleh.add("b");
+ bleh.add("c");
+ String quizName = "testquiz";
+
btnSubmit = new Button("Submit Quiz");
btnSubmit.setPrefWidth(150);
btnSubmit.setPrefHeight(40);
@@ -131,7 +142,7 @@ else if (currLine.length() > 1) {
//method to create page
public void generatePage(int index) {
-
+
//create new pane and set the dimensions
Pane pane = new Pane();
pane.setPrefHeight(paneHeight);
@@ -166,6 +177,21 @@ public void generatePage(int index) {
System.out.println(count);
if(pageCount == count-1){
pane.getChildren().add(btnSubmit);
+ btnSubmit.setOnAction(new EventHandler() {
+
+ @Override
+ public void handle(ActionEvent e) {
+ System.out.println("here1");
+ ArrayList bleh = new ArrayList<>();
+ bleh.add("a");
+ bleh.add("b");
+ bleh.add("c");
+ String quizName = "testquiz";
+ System.out.println("here2");
+ db.Write("INSERT INTO " + quizName + " VALUES ('abc@gmail.com', "
+ + "bleh" + 80 + ");");
+ System.out.println("here3");
+ }});
}
@@ -226,6 +252,9 @@ public ArrayList getScenes() {
public Button getBtnNext() {
return btnNext;
}
+ public Button getBtnSubmit() {
+ return btnSubmit;
+ }
}
diff --git a/src/gui/Quiz.java b/src/gui/Quiz.java
index b8bc00e..b8d539b 100644
--- a/src/gui/Quiz.java
+++ b/src/gui/Quiz.java
@@ -1,11 +1,15 @@
package gui;
+import java.util.ArrayList;
+
+import comm.DataBase;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.stage.Stage;
public class Quiz extends Application{
+ private DataBase db = new DataBase();
private int pageNum = 0;
@@ -42,10 +46,34 @@ public void handle(ActionEvent e) {
@Override
public void handle(ActionEvent e) {
+ System.out.println("here1");
+ ArrayList bleh = new ArrayList<>();
+ bleh.add("a");
+ bleh.add("b");
+ bleh.add("c");
+ String quizName = "testquiz";
+ db.Write("INSERT INTO " + quizName + " VALUES ('abc@gmail.com', "
+ + "bleh" + 80 + ");");
pageNum++;
qPages.generatePage(pageNum);
stage.setScene(qPages.getScenes().get(pageNum));
}});
+
+ qPages.getBtnSubmit().setOnAction(new EventHandler() {
+
+ @Override
+ public void handle(ActionEvent e) {
+ /* System.out.println("here1");
+ ArrayList bleh = new ArrayList<>();
+ bleh.add("a");
+ bleh.add("b");
+ bleh.add("c");
+ String quizName = "testquiz";
+ System.out.println("here2");
+ db.Write("INSERT INTO " + quizName + " VALUES ('abc@gmail.com', "
+ + "bleh" + 80 + ");");
+ System.out.println("here3");*/
+ }});
stage.setScene(loginPage.getScene());
stage.show();
@@ -53,5 +81,4 @@ public void handle(ActionEvent e) {
}
-
}
\ No newline at end of file