Answered step by step
Verified Expert Solution
Link Copied!

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.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
public class BuildSpellbook {
public final Integer MAXCOMS =1000; // 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 min(N, 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 min(N, 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 min(N, 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 min(N, 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 readSpecsFromFile(String fInName) throws IOException {
// PRE: -
// POST: returns lines from input file as vector of string
BufferedReader fIn = new BufferedReader(
new FileReader(fInName));
String s;
Vector comList = new Vector();
while ((s = fIn.readLine())!= null){
comList.add(s);
}
fIn.close();
return comList;
}
public Vector readSolnFromFile(String 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 FileReader(fInName));
String s;
Vector out = new Vector();
Integer i =0;
while (((s = fIn.readLine())!= null) && (i <= N)){
if ((i != N)|| s.startsWith(""))// responses to commands start with three spaces
out.add(s);
if (!s.startsWith(""))
i +=1;
}
fIn.close();
return out;
}
public Boolean compareExecWSoln (Vector execd, Vector soln){
// PRE: -
// POST: Returns True if execd and soln string-match exactly, False otherwise
if (execd.size()!= soln.size()){
return Boolean.FALSE;
}
for (int i =0; i < execd.size(); i++){
if (!execd.get(i).equals(soln.get(i))){
return Boolean.FALSE;
}
}
return Boolean.TRUE;
}
public static void main(String[] args){
}
}
PLS FINISH ALL CODE FOR ME, Its a personasl project.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

How comfortable or uncomfortable are you in making risky decisions?

Answered: 1 week ago

Question

Discuss the roles of metacognition in learning and remembering.

Answered: 1 week ago