This is the code that needs to be completed...
import java.util.ArrayList;
import java.util.Collections;
/**
* Write a description of class SpellChecker here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SpellChecker
{
private ArrayList words;
private DictReader reader;
/**
* Constructor for objects of class SpellChecker
*/
public SpellChecker()
{
reader = new DictReader("words.txt");
words = reader.getDictionary();
}
/**
* This method returns the number of words in the dictionary.
* Change this.
*/
public int numberOfWords()
{
return 0;
}
/**
* This method returns true, if (and only if) the given word is
found in the dictionary.
* Complete this.
*/
public boolean isKnownWord(String word)
{
return false;
}
/**
* This method returns true if (and only if) all words in the given
wordList are found in the dictionary.
// Complete this.
*/
public boolean allKnown(ArrayList wordList)
{
return false;
}
/**
* This method tests the allKnown method. You do not need to change
this method.
*/
public boolean testAllKnown()
{
ArrayList testWords = new ArrayList();
testWords.add("Abu");
testWords.add("Chou");
if(allKnown(testWords))
{
return true;
}
else
{
return false;
}
}
/**
* This method returns a list of all words from the dictionary that
start with the given prefix.
* Complete this.
*/
public ArrayList wordsStartingWith(String prefix)
{
return null;
}
/**
* This method returns a list of all words from the dictionary that
include the given substring.
* Complete this.
*/
public ArrayList wordsContaining(String text)
{
return null;
}
/**
* Insert the given word into the dictionary.
* The word should only be inserted if it does not already exist in
the dictionary.
* If it does, the method does nothing.
* Make sure that the alphabetic order of the dictionary is
maintained.
* Complete this.
*/
public void insert(String newWord)
{
}
/**
* Remove the given word from the dictionary.
* If the word was successfully removed, return true.
* If not (for example it did not exist) return false.
*/ Complete this.
public boolean remove(String word)
{
return false;
}
/**
* Save the dictionary to disk.
* This is not meant to be hard – there is a method in the
DictReader class that you can use.
* Complete this
*/
public void save()
{
}
}
And this is the other class that is completed but helps run the incomplete code above.
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
/**
* Class DictReader offers functionality to load a dictionary from a
file,
* and to save it back to a file.
*
* To use this class, create an instance of this class with the file
name as
* a parameter. Then call 'getDictionary' to receive the dictionary
object.
*
* @author M. Kolling
* @version 2006-10-24
*/
public class DictReader
{
private ArrayList dict;
private String filename;
/**
* Create a DictReader instance from a file.
*/
public DictReader(String filename)
{
loadDictionary(filename);
this.filename = filename;
}
/**
* Return the dictionary as a list of words.
*/
public ArrayList getDictionary()
{
return dict;
}
/**
* Accept a new dictionary and save it under the same name. Use the
new
* one as our dictionary from now on.
*/
public void save(ArrayList dictionary)
{
try {
FileWriter out = new FileWriter(filename);
for(String word : dictionary) {
out.write(word);
out.write("\n");
}
out.close();
dict = dictionary;
}
catch(IOException exc) {
System.out.println("Error writing dictionary file: " + exc);
}
}
/**
* Load the dictionary from disk and store it in the 'dict'
field.
*/
private void loadDictionary(String filename)
{
dict = new ArrayList();
try {
BufferedReader in = new BufferedReader(new
FileReader(filename));
String word = in.readLine();
while(word != null) {
dict.add(word);
word = in.readLine();
}
in.close();
}
catch(IOException exc) {
System.out.println("Error reading dictionary file: " + exc);
}
}
}
In: Computer Science
For this assignment, you will use the provided database in the Unit 5 script file. You will add statements to this file to query the database tables. For your reference, below is a screenshot of the enhanced entity relationship diagram (ERD) as a reference when you write your queries. With the data types listed in the diagram, this will help you identify the types of operators that you can use for particular queries.
Use paiza.io for MySQL to execute and troubleshoot your Structured Query Language (SQL) statements. It is recommended that you use Notepad to write your SQL statements. Then, copy and paste your SQL statements to paiza.io to test your statements to ensure that they execute without errors. Save your work frequently.
The asterisk (*) indicates that a column is not null (i.e., required to have a value).
I didnt understand by what you mean by SQL TEST. If what you are asking me is that an SQL TEST? Yes! It is SQL QUERY TEST!!
In: Advanced Math
In the program the "case: 'C'" doesn't seem to function correctly,
We were told to write a book tracking program, and it takes inputs and once all the book info such as ISBN, date, author, course number, etc are put in then input, then we can print them out, by using the print functions that are defined in the program. Example:
the formats are as follows, when defining the book: "B-ISBN-TITLE"
So then in the terminal once the code compiles I can input: "B 1234567890123 Title of book"
and thus that book is defined, and I needed to make the code print the books info out and it's format were "GB-ISBN"
So then in the terminal after the book is defined I can type "GB 1234567890123" and the isbn and books title will be printed out that were define above.
NOW my problem is with the C which defines a course and it's format is "C-Department Code-Course Number-Name"
So if type "C CSEC 215 Name of the course" it should store it, until I use the print function "PC" which will print out the course that are defined. BUT I am getting an "abort message, out of range", and it points the error at the "case: C" switch statement in the code.
Can someone take a look at the code and help me figure out the solution,
Here is the code:
#include
#include
#include
#include
using namespace std;
int bookCounter = 0, courseCounter = 0, classCounter = 0;
struct Book
{
long isbn;
string title;
string author;
int edition;
string publicationDate;
double newRate = -1;
double usedRate = -1;
double rentedRate = -1;
double eRate = -1;
}* books[100];
struct Course
{
int deptCode;
int courseNumber;
string name;
}*course[100];
struct Class
{
struct Book *book;
struct Course *course;
int sectionNumber;
bool required;
}*classes[100];
int getBook( long newISBN)
{
for(int i=0; i {
if(books[i]->isbn == newISBN)
{
return i;
}
}
return -1;
}
int getCourse(int courseNum, int dept)
{
for(int i=0; i {
if(course[i]->courseNumber == courseNum &&
course[i]->deptCode == dept)
{
return i;
}
}
return -1;
}
void printBooks(string code, istringstream &iss)
{
int deptCode, sectionNum, courseNum;
long isbn;
if(code == "GC") iss>>deptCode>>courseNum;
else if(code=="GS")
iss>>deptCode>>courseNum>>sectionNum;
else if(code == "GB") iss>>isbn;
for(int i=0; i {
if(code=="GB" && classes[i]->book->isbn==isbn)
{
coutisbn<<" "title<<" ";
if(classes[i]->required)
cout<<"Required\n";
else cout<<"Optional\n";
}
else if(classes[i]->course->courseNumber == courseNum
&& classes[i]->course->deptCode == deptCode)
{
if(code=="GS" && classes[i]->sectionNumber ==
sectionNum)
{
coutisbn<<" "title<<" ";
if(classes[i]->required)
cout<<"Required\n";
else cout<<"Optional\n";
}
if(code == "GC")
{
coutisbn<<" "title<<" ";
if(classes[i]->required)
cout<<"Required\n";
else cout<<"Optional\n";
}
}
}
}
void printAllInfo(string code, istringstream &iss)
{
if(code == "PB")
{
for(int i=0; i {
cout
if(classes[i]->course->deptCode==deptCode)
{
coutisbn<<" "title<<"\n";
}
}
}
else if(code == "PY")
{
int pmonth, pyear, checkMonth, checkYear;
int ch;
iss>>checkMonth>>ch>>checkYear;
for(int i=0; i {
istringstream isstreamer(books[i]->publicationDate);
isstreamer>>pmonth>>ch>>pyear;
if((pyear==checkYear &&
pmonth>checkMonth)||(pyear>checkYear))
{
cout
In: Computer Science
#11 According to an airline, flights on a certain route are on
time 75% of the time. Suppose 15 flights are randomly selected and
the number of on-time flights is recorded.
(a) Explain why this is a binomial experiment.
(b) Find and interpret the probability that exactly 9 flights are
on time.
(c) Find and interpret the probability that fewer than 9 flights
are on time.
(d) Find and interpret the probability that at least 9 flights are
on time.
(e) Find and interpret the probability that between 7 and 9
flights, inclusive, are on time.
Identify the statements that explain why this is a binomial experiment. Select all that apply.
A. There are two mutually exclusive outcomes, success or failure.
B. The experiment is performed until a desired number of successes is reached.
C. There are three mutually exclusive possibly outcomes, arriving on-time, arriving early, and arriving late.
D. Each trial depends on the previous trial.
E. The probability of success is the same for each trial of the experiment.
F. The experiment is performed a fixed number of times.
G. The trials are independent.
b) The probability that exactly 9 flights are on time is
In 100 trials of this experiment, it is expected about __ to result in exactly 9 flights being on time.
c) The probability that fewer than 9 flights are on time is ____
In 100 trials of this experiment, it is expected about ___ to result in at least 9 flights being on time.
e) The probability that between 7 and 9 flights, inclusive, are on time is ___
In 100 trials of this experiment, it is expected about ___ to result in between 7 and 9 flights, inclusive, being on time.(Round to the nearest whole number as needed.)
In: Statistics and Probability
This is a Lab Report about an experiment.
The experiment should be about HEAT and TEMPERATURE with any example.
Title:
Hypothesis: Statement that the experiment is going to test, prove, or disprove. What is the point of the experiment? (Make a statement that the experiment will either prove or disprove.)
Overview: Brief summary of what occurred in the experiment or what was tested and how.
Uncertainty&Error: Can you trust your data?
Considerations:
1) What factors may have affected or biased the data and introduced uncertainty in the lab measurements? Or, what conditions created uncertainty in your measurements? Which measurements were most affected?”
2) If you were conducting the lab in a physical environment, what other factors would have to be taken into account while accomplishing the procedures? How might they affect the data and/or experiment outcome?
Conclusion/Summary: This section must contain each of the items listed below. You are now the one speaking, of your personal results. Although this is merely an example, it does contain all the requisite components. You may write this section how you see fit, as long as the items annotated are included. However, a checklist or bullet list is not acceptable. The clarity and flow of your conclusion/summary should make clear to any ready what you did in the experiment and how it turned out.
Application: How does this topic—and science in general—impact our understanding of the complex, technological society of which we are a part? How does this explain something in the real world around you?
In: Physics
I am confused about how the pattern and how to get only some letters that are needed and numbers?
New Perspectives HMTL5, CSS3, and JavaScript Chapter 13 Case Problem 2
HTML Document
Scroll down to the empInfo table and add pattern attributes to the following fields using regular expressions (Note: Regular expressions in the HTML pattern attribute do not include the opening and closing / character):
Take some time to study the class names for the input elements in the travelExp table. This table will be used to calculate the total travel expenses for each day and across all categories.
Note that input elements that contribute to the total are placed in the sum class. Inputelements belonging to a common date are placed in the date0 through date5 classes. Finally, input elements belonging to different expense categories are placed in the trans, lodge, meal, and other classes.
<!DOCTYPE html>
<html lang="en">
<head>
<!--
New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
Tutorial 13
Case Problem 2
Travel Expense Report
Author:
Date:
Filename: dl_expenses.html
-->
<title>DeLong Enterprises Expense Report</title>
<meta charset="utf-8" />
<link href="dl_base.css" rel="stylesheet" />
<link href="dl_layout.css" rel="stylesheet" />
<script src="dl_expenses.js" async></script>
</head>
<body>
<header>
<nav class="horizontal">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Policies</a></li>
<li><a href="#">Reports</a></li>
<li><a href="#">Employment</a></li>
<li><a href="#">Financial</a></li>
<li><a href="#">Insurance</a></li>
<li><a href="#">Accounts</a></li>
</ul>
</nav>
<img src="dl_logo.png" alt="DeLong Enterprises" id="logoImg" />
</header>
<section>
<form name="expReport" id="expReport" method="post" action="dl_valid.html">
<table id="travelSummary">
<tr>
<th>Trip Summary<span>*</span></th>
</tr>
<tr>
<td>
<textarea id="summary" name="summary" required></textarea>
</td>
</tr>
</table>
<aside>
<h1>Expense Report</h1>
<p>Form: 2CEXP15<br />
* --- Required Field
</p>
<p>Send Report To:<br />
Debbie Larson<br />
Personnel Dept.<br />
Rm. 3801<br />
Ext. 1250
</p>
</aside>
<table id="empInfo">
<tr>
<th>Last Name<span>*</span></th>
<th>First Name<span>*</span></th>
<th>M.I.</th>
<th>Account<span>*</span></th>
<td><input type="text" name="accID" id="accID" pattern="\d{6}$" placeholder="ACTnnnnnn" required /></td>
</tr>
<tr>
<td><input type="text" name="lname" id="lname" required /></td>
<td><input type="text" name="fname" id="fname" required /></td>
<td><input type="text" name="init" id="init" required /></td>
<th>Department<span>*</span></th>
<td><input type="text" name="deptID" id="deptID" required placeholder="DEPTnnnnnn" /></td>
</tr>
<tr>
<th>Social Security Number<span>*</span></th>
<td colspan="2"><input type="text" name="ssn" id="ssn" required placeholder="nnn-nn-nnnn" /></td>
<th>Project<span>*</span></th>
<td><input type="text" name="projID" id="projID"
In: Computer Science
There is some evidence that, in the years 1981-85 , a simple name change resulted in a short-term increase in the price of certain business firms' stocks (relative to the prices of similar stocks). (See D. Horsky and P. Swyngedouw, "Does it pay to change your company's name? A stock market perspective," Marketing Science v., pp.320-35, 1987 .) Suppose that, to test the profitability of name changes in the more recent market (the past five years), we analyze the stock prices of a large sample of corporations shortly after they changed names, and we find that the mean relative increase in stock price was about 0.72%, with a standard deviation of 0.11%. Suppose that this mean and standard deviation apply to the population of all companies that changed names during the past five years. Complete the following statements about the distribution of relative increases in stock price for all companies that changed names during the past five years. (a) According to Chebyshev's theorem, at least 36% of the relative increases in stock price lie between ___ and ___ . (Round your answer to 2 decimal places.) (b) According to Chebyshev's theorem, at least ___of the relative increases in stock price lie between 0.50 % and 0.94 %. (c) Suppose that the distribution is bell-shaped. According to the empirical rule, approximately ___ of the relative increases in stock price lie between 0.50 % and 0.94 %. (d) Suppose that the distribution is bell-shaped. According to the empirical rule, approximately 99.7% of the relative increases in stock price lie between ___and ____ .
In: Statistics and Probability
You roll two fair dice, and denote the number they show by X and Y. Let U = min{X, Y } and V = max{X, Y }. Write down the joint probability mass function of (U, V ) and compute ρ(U, V ) i.e the correlation coefficient of U and V
In: Statistics and Probability
What is the value for Ecell for the reaction shown below if each one of the dissolved species has a concentration of 0.1 M?
2 Fe3+ (aq) + 2 I-(aq) → 2 Fe2+(aq) + I2(s)
a) -0.35 V
b) -0.29 V
c) +0.11 V
d) +0.17 V
In: Chemistry
A silver wire with resistivity 1.59 x 10^-8 ? x m carries a current density of 4.0 mm^2. What is the magnitude of the electric field inside the wire?
A) 0.064 V/m
B) 2.5 V/m
C) 0.040 V/m
D) 0.10 V/m
In: Physics