diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..919ce1f
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..91063aa
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..0035de0
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Agile.iml b/Agile.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/Agile.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/project/Data.java b/src/project/Data.java
new file mode 100644
index 0000000..19d7c36
--- /dev/null
+++ b/src/project/Data.java
@@ -0,0 +1,100 @@
+package project;
+
+import javax.swing.*;
+import java.io.*;
+import java.util.Scanner;
+
+public class Data {
+
+ protected String year;
+ protected String totalEnergySupply;
+ protected String business;
+ protected String transport;
+ protected String pub;
+ protected String residential;
+ protected String agriculture;
+ protected String industrial;
+ protected String waste;
+ protected String totalCO2;
+ protected String otherGases;
+ protected String totalGHG;
+
+ //constructor
+ public Data(String year, String totalEnergySupply, String business, String transport,
+ String pub, String residential, String agriculture, String industrial,
+ String waste, String totalCO2, String otherGases, String totalGHG) {
+
+ this.year = year;
+ this.totalEnergySupply = totalEnergySupply;
+ this.business = business;
+ this.transport = transport;
+ this.pub = pub;
+ this.residential = residential;
+ this.agriculture = agriculture;
+ this.industrial = industrial;
+ this.waste = waste;
+ this.totalCO2 = totalCO2;
+ this.otherGases = otherGases;
+ this.totalGHG = totalGHG;
+ }
+
+ //method for reading info on .txt file
+ public static void readData(String searchTerm, String filepath) {
+
+ boolean found = false;
+ String year = "";
+ String totalEnergySupply = "";
+ String business = "";
+ String transport = "";
+ String pub = "";
+ String residential = "";
+ String agriculture = "";
+ String industrial = "";
+ String waste = "";
+ String totalCO2 = "";
+ String otherGases = "";
+ String totalGHG = "";
+
+ try {
+
+ Scanner x = new Scanner(new File(filepath));
+ x.useDelimiter("[,\n]");
+
+ while (x.hasNextLine() && !found) {
+ year = x.next();
+ totalEnergySupply = x.next();
+ business = x.next();
+ transport = x.next();
+ pub = x.next();
+ residential = x.next();
+ agriculture = x.next();
+ industrial = x.next();
+ waste = x.next();
+ totalCO2 = x.next();
+ otherGases = x.next();
+ totalGHG = x.next();
+
+ if (year.equals(searchTerm)) {
+
+ found = true;
+ }
+ }
+
+ if (found) { //if date equals name on .txt line print info from that line on the pop-up window
+
+ JOptionPane.showMessageDialog(null, "Year: " + year + ", " + "Energy Supply: " + totalEnergySupply + ", " + "Business: " +
+ business + ", " + "Transport: " + transport + ", " + "Public Sector: " + pub + ", " + "Residential: " + residential + ", " + "Agriculture: " + agriculture + ", " +
+ "Industrial: " + industrial + ", " + "Waste: " + waste + ", " + "Total CO2: " + totalCO2 + ", " + "Other Gases: " + otherGases + ", " + "Total GHG: " + totalGHG);
+
+ } else { //if no name equals search term
+
+ JOptionPane.showMessageDialog(null, "Not found");
+
+ }
+
+ } catch (Exception e) {
+
+ JOptionPane.showMessageDialog(null, "Operation Failed");
+ }
+ }
+}
diff --git a/src/project/DataFrame.java b/src/project/DataFrame.java
new file mode 100644
index 0000000..f5aa8c7
--- /dev/null
+++ b/src/project/DataFrame.java
@@ -0,0 +1,118 @@
+package project;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class DataFrame extends JFrame implements ActionListener {
+
+ private final JButton submit;
+ protected static JComboBox select;
+
+ String year = "";
+ String totalEnergySupply = "";
+ String business = "";
+ String transport = "";
+ String pub = "";
+ String residential = "";
+ String agriculture = "";
+ String industrial = "";
+ String waste = "";
+ String totalCO2 = "";
+ String otherGases = "";
+ String totalGHG = "";
+
+ ArrayList selectDates = new ArrayList<>();
+
+ // constructor, to initialize the components with default values.
+ public DataFrame() {
+
+ //set window parameters
+ setTitle("Get User Information"); //set window title
+ setBounds(300, 90, 400, 200); //set size of window when it opens
+ setDefaultCloseOperation(EXIT_ON_CLOSE); //behaviour of close button
+ setResizable(false); //prevent user resizing window
+
+ // Components of the Form
+ Container c = getContentPane();
+ c.setLayout(null);
+
+ //edit account tag
+ JLabel account = new JLabel("Select Date");
+ account.setFont(new Font("Arial", Font.PLAIN, 20));
+ account.setSize(150, 20);
+ account.setLocation(50, 50);
+ c.add(account);
+
+ try {
+
+ Scanner scanner = new Scanner(new File("historicData.txt"));
+ scanner.useDelimiter("[,\n]");
+
+ while (scanner.hasNext()) {
+ year = scanner.next();
+ totalEnergySupply = scanner.next();
+ business = scanner.next();
+ transport = scanner.next();
+ pub = scanner.next();
+ residential = scanner.next();
+ agriculture = scanner.next();
+ industrial = scanner.next();
+ waste = scanner.next();
+ totalCO2 = scanner.next();
+ otherGases = scanner.next();
+ totalGHG = scanner.next();
+ selectDates.add(year);
+ }
+
+ } catch (Exception e) {
+
+ JOptionPane.showMessageDialog(null, "Operation Failed");
+ }
+
+ //select account
+ String[] array = new String[selectDates.size()];
+ for (int i = 0; i < array.length; i++) {
+ array[i] = selectDates.get(i);
+ }
+
+ select = new JComboBox(array);
+ select.setFont(new Font("Arial", Font.PLAIN, 15));
+ select.setSize(150, 20);
+ select.setLocation(180, 50);
+ c.add(select);
+
+ //submit button
+ submit = new JButton("Submit");
+ submit.setFont(new Font("Arial", Font.PLAIN, 15));
+ submit.setSize(100, 20);
+ submit.setLocation(150, 100);
+ submit.addActionListener(this);
+ c.add(submit);
+
+ JTextArea promptAdd = new JTextArea();
+ promptAdd.setFont(new Font("Arial", Font.PLAIN, 15));
+ promptAdd.setSize(200, 75);
+ promptAdd.setLocation(580, 175);
+ promptAdd.setLineWrap(true);
+ c.add(promptAdd);
+
+ setVisible(true);
+ }
+
+ // method to set behaviour of submit button
+ public void actionPerformed(ActionEvent e) {
+
+ if (e.getSource() == submit) {
+
+ DataSorting.find();
+ this.dispose();
+ //new ManageDeviceFrame();
+
+ }
+ }
+}
diff --git a/src/project/DataSorting.java b/src/project/DataSorting.java
new file mode 100644
index 0000000..d74bdaf
--- /dev/null
+++ b/src/project/DataSorting.java
@@ -0,0 +1,11 @@
+package project;
+
+public class DataSorting {
+
+ //method finds a device on the .txt file and reads it back to the user
+ public static void find(){
+
+ String searchTerm = (String) DataFrame.select.getSelectedItem();
+ Data.readData(searchTerm,"historicData.txt");
+ }
+}
diff --git a/src/project/Main.java b/src/project/Main.java
new file mode 100644
index 0000000..5bcc84e
--- /dev/null
+++ b/src/project/Main.java
@@ -0,0 +1,10 @@
+package project;
+
+public class Main {
+ public static void main(String[] args) {
+
+ //new AddDeviceFrame();
+ new DataFrame();
+
+ }
+}