Answered step by step
Verified Expert Solution
Question
1 Approved Answer
package student; import java.io . BufferedReader; import java.io . FileReader; import java.io . IOException; import java.util. * ; public class BuildSpellbook { public final Integer
package student; import java.ioBufferedReader; import java.ioFileReader; import java.ioIOException; import java.util.; public class BuildSpellbook public final Integer MAXCOMS ; maximum number of specs TODO: add appropriate attributes variables public BuildSpellbook Constructor TODO public Vector execNSpecs Vector specs, Integer N PRE: specs contains set of specifications read in by readSpecsFromFile POST: executed minN all specifications, returning required output, one line per string in vector TODO return new Vector; public Vector execNSpecswCheck Vector specs, Integer N PRE: specs contains set of specifications read in by readSpecsFromFile POST: executed minN all specifications, checking for cycles, returning required output, one line per string in vector TODO return new Vector; public Vector execNSpecswCheckRecLarge Vector specs, Integer N PRE: specs contains set of specifications read in by readSpecsFromFile POST: executed minN all specifications, checking for cycles and recommending fix by removing largest cycle, returning required output, one line per string in vector TODO return new Vector; public Vector execNSpecswCheckRecSmall Vector specs, Integer N PRE: specs contains set of specifications read in by readSpecsFromFile POST: executed minN all specifications, checking for cycles and recommending fix by removing smallest cycle, returning required output, one line per string in vector TODO return new Vector; Provided files below public Vector readSpecsFromFileString fInName throws IOException PRE: POST: returns lines from input file as vector of string BufferedReader fIn new BufferedReader new FileReaderfInName; String s; Vector comList new Vector; while s fIn.readLine null comList.adds; fIn.close; return comList; public Vector readSolnFromFileString fInName, Integer N throws IOException PRE: POST: returns up to N lines from input file as a vector of N strings; only the specification lines are counted in this N not responses BufferedReader fIn new BufferedReader new FileReaderfInName; String s; Vector out new Vector; Integer i ; while s fIn.readLine null && i N if i N sstartsWith responses to commands start with three spaces out.adds; if sstartsWith i ; fIn.close; return out; public Boolean compareExecWSoln Vector execd, Vector soln PRE: POST: Returns True if execd and soln stringmatch exactly, False otherwise if execdsize soln.size return Boolean.FALSE; for int i ; i execd.size; i if execd.getiequalssolngeti return Boolean.FALSE; return Boolean.TRUE; public static void mainString args PLS FINISH ALL CODE FOR ME Its a personasl project.
package student;
import java.ioBufferedReader;
import java.ioFileReader;
import java.ioIOException;
import java.util.;
public class BuildSpellbook
public final Integer MAXCOMS ; maximum number of specs
TODO: add appropriate attributes variables
public BuildSpellbook
Constructor
TODO
public Vector execNSpecs Vector specs, Integer N
PRE: specs contains set of specifications read in by readSpecsFromFile
POST: executed minN all specifications,
returning required output, one line per string in vector
TODO
return new Vector;
public Vector execNSpecswCheck Vector specs, Integer N
PRE: specs contains set of specifications read in by readSpecsFromFile
POST: executed minN all specifications, checking for cycles,
returning required output, one line per string in vector
TODO
return new Vector;
public Vector execNSpecswCheckRecLarge Vector specs, Integer N
PRE: specs contains set of specifications read in by readSpecsFromFile
POST: executed minN all specifications, checking for cycles and
recommending fix by removing largest cycle,
returning required output, one line per string in vector
TODO
return new Vector;
public Vector execNSpecswCheckRecSmall Vector specs, Integer N
PRE: specs contains set of specifications read in by readSpecsFromFile
POST: executed minN all specifications, checking for cycles and
recommending fix by removing smallest cycle,
returning required output, one line per string in vector
TODO
return new Vector;
Provided files below
public Vector readSpecsFromFileString fInName throws IOException
PRE:
POST: returns lines from input file as vector of string
BufferedReader fIn new BufferedReader
new FileReaderfInName;
String s;
Vector comList new Vector;
while s fIn.readLine null
comList.adds;
fIn.close;
return comList;
public Vector readSolnFromFileString fInName, Integer N throws IOException
PRE:
POST: returns up to N lines from input file as a vector of N strings;
only the specification lines are counted in this N not responses
BufferedReader fIn new BufferedReader
new FileReaderfInName;
String s;
Vector out new Vector;
Integer i ;
while s fIn.readLine null && i N
if i N sstartsWith responses to commands start with three spaces
out.adds;
if sstartsWith
i ;
fIn.close;
return out;
public Boolean compareExecWSoln Vector execd, Vector soln
PRE:
POST: Returns True if execd and soln stringmatch exactly, False otherwise
if execdsize soln.size
return Boolean.FALSE;
for int i ; i execd.size; i
if execd.getiequalssolngeti
return Boolean.FALSE;
return Boolean.TRUE;
public static void mainString args
PLS FINISH ALL CODE FOR ME Its a personasl project.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started