diff --git a/.classpath b/.classpath
index 3cc104c..09ba841 100644
--- a/.classpath
+++ b/.classpath
@@ -22,6 +22,5 @@
-
diff --git a/WebContent/html/javascript/statistics.jsp b/WebContent/html/javascript/statistics.jsp
new file mode 100644
index 0000000..d8eff72
--- /dev/null
+++ b/WebContent/html/javascript/statistics.jsp
@@ -0,0 +1,67 @@
+<%@ page import = "database.*,entities.Statistics" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
+
+
+
+
+Insert title here
+
+
+<%
+Statistics[] genStatistics = StatisticsQueries.getStatistics();
+String statString = Statistics.arrayToString(genStatistics);
+%>
+
+
+
\ No newline at end of file
diff --git a/WebContent/html/webpages/statisticsPage.jsp b/WebContent/html/webpages/statisticsPage.jsp
new file mode 100644
index 0000000..a201a43
--- /dev/null
+++ b/WebContent/html/webpages/statisticsPage.jsp
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+ Synchrony Financial
+
+
+
+
+
+
+
+
+
+
+
+
+ <%@ include file="../javascript/statistics.jsp" %>
+
+
\ No newline at end of file
diff --git a/src/database/StatisticsQueries.java b/src/database/StatisticsQueries.java
new file mode 100644
index 0000000..289252d
--- /dev/null
+++ b/src/database/StatisticsQueries.java
@@ -0,0 +1,36 @@
+package database;
+import java.sql.*;
+import entities.Statistics;
+
+public class StatisticsQueries {
+
+ private static String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317";
+ private static String user = "b372dfe7409692";
+ private static String password = "74f6e317";
+
+ public static Statistics[] getStatistics() throws ClassNotFoundException, SQLException {
+ //database connect
+ System.getenv("VCAP_SERVICES");
+ Class.forName("com.mysql.jdbc.Driver");
+ Connection connection = DriverManager.getConnection(database, user, password);
+ Statement stmt = connection.createStatement();
+ ResultSet resultSet = stmt.executeQuery("SELECT Status, count(*) FROM devices GROUP BY Status");
+ int counter = 0;
+
+ resultSet.last();
+ int rows = resultSet.getRow();
+ resultSet.beforeFirst();
+
+ Statistics[] statusDevice = new Statistics[rows];
+ //iterate result set
+ while(resultSet.next()){
+ statusDevice[counter] = new Statistics(resultSet.getString("Status"), resultSet.getInt("count(*)"));
+ counter++;
+ }
+ stmt.close();
+ connection.close();
+ return statusDevice;
+
+ }
+
+}
diff --git a/src/entities/Statistics.java b/src/entities/Statistics.java
new file mode 100644
index 0000000..ed12f49
--- /dev/null
+++ b/src/entities/Statistics.java
@@ -0,0 +1,42 @@
+package entities;
+
+public class Statistics {
+ private String _status;
+ private int _count;
+ public Statistics(String status,int count) {
+ _status = status;
+ _count = count;
+ }
+
+ /**
+ * Formatting the statistics to fit a JSON object.
+ * @author - Connor
+ */
+ public String toString(){
+ StringBuilder sb = new StringBuilder();
+ String comma = ", ";
+ sb.append("{\"status\": \"").append(_status).append("\"").append(comma);
+ sb.append("\"count\": \"").append(_count).append("\"");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * This is a static function which will turn a Listed Statistics array into its proper string. (modification)
+ * @author - Connor
+ * @param array
+ * @return
+ */
+ public static String arrayToString(Statistics[] array){
+ StringBuilder sb = new StringBuilder();
+ sb.append("[");
+ for(int i = 0; i < array.length; i++){
+ sb.append(array[i].toString());
+ if(i+1 != array.length){
+ sb.append(",");
+ }
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+}