Question: Hi ! I need help completing the interface methods in CompletedMain.java. The three methods that need to be completed are loadKanji ( String filename, EditableDiGraph

Hi! I need help completing the interface methods in CompletedMain.java. The three methods that need to be completed are loadKanji(String filename, EditableDiGraph graph), loadDataComponents(String filename, EditableDiGraph graph), and buildOrderString(EditableDiGraph graph, TopologicalSort topSort, HashMap kanjiMap). The first method should load data-kanji.txt, use it to populate a hashmap that maps IDs to characters, and add the IDs as nodes in the graph. The second method should load data-components.txt, and use it to add edges to the graph. The third method should create an IntuitiveTopological object and use it to sort the graph and also display the characters in the ordering. The output contains only the kanji characters, no other formatting or spaces. Thank you so much for the help!
DO NOT USE ANY STAR IMPORTS OR PACKAGES OTHER THAN THE FOLLOWING:
java.io.BufferedReader
java.io.BufferedWriter
java.io.File
java.io.FileInputStream
java.io.FileNotFoundException
java.io.FileOutputStream
java.io.FileReader
java.io.InputStreamReader
java.io.IOException
java.io.OutputStreamWriter
java.io.UnsupportedEncodingException
java.util.HashMap
java.util.LinkedList
java.util.NoSuchElementException
Here is the code provided in CompletedMain.java:
package edu.ser222.m04_02;
/**
*(basic description of the program or class)
*
* Completion time: (estimation of hours spent on this program)
*
* @author (your name), Acuna, Buckner
* @version (a version number or a date)
*/
//Note: not all of these packages may be needed.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.HashMap;
public class CompletedMain implements KanjiMain {
//Do not add any member variables to this class.
//TODO: implement interface methods.
public HashMap loadKanji(String filename, EditableDiGraph graph){
throw new java.lang.UnsupportedOperationException("TODO!");
}
public void loadDataComponents(String filename, EditableDiGraph graph){
throw new java.lang.UnsupportedOperationException("TODO!");
}
public String buildOrderString(EditableDiGraph graph, TopologicalSort topSort, HashMap kanjiMap){
throw new java.lang.UnsupportedOperationException("TODO!");
}
public static void main(String[] args){
/***************************************************************************
* START - CORE DRIVER LOGIC, DO NOT MODIFY *
**************************************************************************/
String FILENAME_KANJI = "data-kanji.txt";
String FILENAME_COMPONENTS = "data-components.txt";
KanjiMain driver = new CompletedMain();
EditableDiGraph graph = new BetterDiGraph();
HashMap kanjiMap = driver.loadKanji(FILENAME_KANJI, graph);
driver.loadDataComponents(FILENAME_COMPONENTS, graph);
TopologicalSort intuitive = new IntuitiveTopological(graph);
System.out.println(driver.buildOrderString(graph, intuitive, kanjiMap));
/***************************************************************************
* END - CORE DRIVER LOGIC, DO NOT MODIFY *
**************************************************************************/
//NOTE: feel free to temporarily comment out parts of the above code while
//you incrementally develop your program. Just make sure all of it is there
//when you test the final version of your program.
//OPTIONAL: add code for extra credit here.
}
}
Hi ! I need help completing the interface methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!