diff --git a/dev/20200407/top19/JSONExample/.idea/compiler.xml b/dev/20200407/top19/JSONExample/.idea/compiler.xml
new file mode 100644
index 0000000..14ce0d2
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/.idea/compiler.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/20200407/top19/JSONExample/.idea/misc.xml b/dev/20200407/top19/JSONExample/.idea/misc.xml
new file mode 100644
index 0000000..d67e0ea
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/20200407/top19/JSONExample/.idea/uiDesigner.xml b/dev/20200407/top19/JSONExample/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/20200407/top19/JSONExample/.idea/workspace.xml b/dev/20200407/top19/JSONExample/.idea/workspace.xml
new file mode 100644
index 0000000..3f945ea
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/.idea/workspace.xml
@@ -0,0 +1,443 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1586533139029
+
+
+ 1586533139029
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JSONExample
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/20200407/top19/JSONExample/JSONExample.iml b/dev/20200407/top19/JSONExample/JSONExample.iml
new file mode 100644
index 0000000..78b2cc5
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/JSONExample.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/dev/20200407/top19/JSONExample/pom.xml b/dev/20200407/top19/JSONExample/pom.xml
new file mode 100644
index 0000000..a6d3c49
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/pom.xml
@@ -0,0 +1,29 @@
+
+
+ 4.0.0
+
+ com.top19.project
+ JSONExample
+ 1.0-SNAPSHOT
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.9.4
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.9.4
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ 2.9.4
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/App.java b/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/App.java
new file mode 100644
index 0000000..37924ae
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/App.java
@@ -0,0 +1,107 @@
+package JSONStuff;
+
+import java.util.LinkedList;
+import java.util.Scanner;
+
+public class App {
+ private Scanner input;
+ private LinkedList dictionary;
+ private JSONProcessor processor;
+
+ public App(){
+ input = new Scanner(System.in);
+ dictionary = new LinkedList();
+ processor = new JSONProcessor();
+ }
+
+ public static void main(String[] args) {
+ App testApp = new App();
+ testApp.runProgram();
+ }
+
+ public void runProgram(){
+ String directory;
+
+ System.out.println("Please enter the file you wish to load: ");
+ directory = input.next();
+ dictionary = processor.readFile(directory);
+
+ int choice = 0;
+
+ do {
+ System.out.println("Please select an option: \n1 - Display all words. \n2 - Display all practice words. \n3 - Add a new word" +
+ "\n4 - Add a new practice word. \n5 - Save to file.");
+
+ choice = input.nextInt();
+
+ switch (choice) {
+ case 1:
+ displayDictionary();
+ break;
+ case 2:
+ displayPracticeWords();
+ break;
+ case 3:
+ addWord();
+ break;
+ case 4:
+ addPracticeWord();
+ break;
+ case 5:
+ processor.saveFile(directory, dictionary);
+ break;
+ default:
+ System.out.println("Error - Please only choose one of the specified options.");
+ }
+ }while (choice != 5);
+ }
+
+ public void displayDictionary() {
+ for (DictionaryEntry entry : dictionary) {
+ System.out.println(entry.toString());
+ }
+ }
+
+ public void displayPracticeWords(){
+ for (DictionaryEntry entry: dictionary){
+ if(entry.isPracticeWord())
+ System.out.println(entry.toString());
+ }
+ }
+
+ public void addWord(){
+ DictionaryEntry newWord = new DictionaryEntry();
+ System.out.println("Please enter the english definition:");
+ newWord.setEnglish(input.next());
+
+ System.out.println("Please enter the welsh definition:");
+ newWord.setWelsh(input.next());
+
+ System.out.println("Please enter the word type:");
+ newWord.setWordType(input.next());
+
+ dictionary.add(newWord);
+ }
+
+ public void addPracticeWord(){
+ DictionaryEntry practiceWord = new DictionaryEntry();
+ int tempIndex;
+
+ System.out.println("Please enter the english definition:");
+ practiceWord.setEnglish(input.next());
+
+ System.out.println("Please enter the welsh definition:");
+ practiceWord.setWelsh(input.next());
+
+ tempIndex = dictionary.indexOf(practiceWord);
+
+ if(tempIndex != -1){
+ dictionary.get(tempIndex).setPracticeWord(true);
+ }else{
+ System.out.println("Error - Please only choose words currently in the dictionary.");
+ }
+
+
+ }
+}
+
diff --git a/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/DictionaryEntry.java b/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/DictionaryEntry.java
new file mode 100644
index 0000000..b321132
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/DictionaryEntry.java
@@ -0,0 +1,65 @@
+package JSONStuff;
+
+public class DictionaryEntry {
+
+ private String english;
+ private String welsh;
+ private String wordType;
+ private boolean practiceWord;
+
+
+ public DictionaryEntry(){
+ practiceWord = false;
+ }
+
+ public DictionaryEntry(String english, String welsh, String wordType ){
+ this.english = english;
+ this.welsh = welsh;
+ this.wordType = wordType;
+ }
+
+ public String getEnglish() {
+ return english;
+ }
+
+ public void setEnglish(String english) {
+ this.english = english;
+ }
+
+ public String getWelsh() {
+ return welsh;
+ }
+
+ public void setWelsh(String welsh) {
+ this.welsh = welsh;
+ }
+
+
+ public String getWordType() {
+ return wordType;
+ }
+
+ public void setWordType(String wordType) {
+ this.wordType = wordType;
+ }
+
+
+ public boolean isPracticeWord() {
+ return practiceWord;
+ }
+
+
+ public void setPracticeWord(boolean practiceWord) {
+ this.practiceWord = practiceWord;
+ }
+
+
+ @Override
+ public String toString() {
+ return "english='" + english + "'\t" +
+ "welsh='" + welsh + "'\t" +
+ "wordType='" + wordType + "'" +
+ "practiceWord = " + practiceWord;
+ }
+
+}
diff --git a/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/JSONProcessor.java b/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/JSONProcessor.java
new file mode 100644
index 0000000..106104c
--- /dev/null
+++ b/dev/20200407/top19/JSONExample/src/main/java/JSONStuff/JSONProcessor.java
@@ -0,0 +1,48 @@
+package JSONStuff;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+
+
+public class JSONProcessor {
+
+ public LinkedList readFile (String path){
+ LinkedList result = new LinkedList<>();
+ ObjectMapper mapper = new ObjectMapper();
+ File dictionary = new File(path);
+
+ try {
+ result.addAll(Arrays.asList(mapper.readValue(dictionary, DictionaryEntry[].class)));
+ } catch (IOException e){
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public void saveFile(String path, LinkedList dictionary){
+ ObjectMapper mapper = new ObjectMapper();
+ String dictionaryString ="";
+
+ try {
+ dictionaryString = mapper.writeValueAsString(dictionary);
+
+ }catch (IOException e){
+ e.printStackTrace();
+ }
+ try {
+ Files.writeString(Paths.get(path), dictionaryString);
+ }catch (IOException e){
+ e.printStackTrace();
+ }
+
+ }
+}