Implement an immutable data type outcast with the following API: publie elass Outcast ( // constructor takes a MordNet object public Outcast (MordNet wordnet) I/ given an array of WordNet nouns, return an outcast public String outcast (String[] nouns) I/ test elient (see below) public statie void main(String[] args) Corner cases. Assume that the argument outcast () contains only valid WordNet nouns and that it contains at least two such nouns. Test client. The following test client takes from the command line the name of a synset file, the name of a hypernym file, followed by the names of outcast files, and prints an outcast in each file: public statie void main(Stringt) args) { WordNet wordnet - new WordNet (args(0), args[1]): Outcast outcast - new Outcast (vordnet); for (int t- 2; t< args.length; t++) { In in - new In(args(t]); Stringl) nouns - in.readAlistrings(); Stdout.println(args(t] + ": + outcast.outcast (nouns)): Here is a sample execution: /Desktop/vordnet> nore outcasts.txt horse zebra cat bear table /Desktop/vordnet> nore outcasta.txt vater soda bed orange_juice nitk apole juice tea coffee /Desktop/werdnet> nore outcastil.txt apple pear peach banana ine lenon blueberry stravberry nango vaternelon potato /Desktop/wordnet java-algs4 Outcast synsets.txt hypernyns.txt outcasts.txt outcasts.txt outcasti1.txt outcasts. txt: table outcasta. txt: bed outcasti1.txt: potato

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Implement an immutable data type outcast with the following API:
public class Outcast {
// constructor takes a WordNet object
public Outcast (WordNet wordnet)
// given an array of WordNet nouns, return an outcast
public String outcast (String[] nouns)
// test client (see below)
public static void main (String[] args)
Corner cases. Assume that the argument to outcast() contains only valid WordNet nouns and that it contains at least two such nouns.
Test client. The following test client takes from the command line the name of a synset file, the name of a hypernym file, followed by the names of outcast files, and prints an outcast in each file:
public static void main(String[] args) {
WordNet wordnet = new WordNet(args[0], args[1]);
Outcast outcast = new Outcast(wordnet);
for (int t = 2; t < args.length; t++) {
In in = new In(args[t]);
String[] nouns = in.readAllStrings();
StdOut.println(args[t] + ": "
+ outcast.outcast(nouns));
}
}
Here is a sample execution:
~/Desktop/wordnet> more outcast5.txt
horse zebra cat bear table
~/Desktop/wordnet> more outcast8.txt
water soda bed orange_juice milk apple_juice tea coffee
~/Desktop/wordnet> more outcast11.txt
apple pear peach banana lime lemon blueberry strawberry mango watermelon potato
~/Desktop/wordnet> java-algs4 Outcast synsets.txt hypernyms.txt outcast5.txt outcast8.txt outcast11.txt
outcast5.txt: table
outcast8.txt: bed
outcast11.txt: potato
Transcribed Image Text:Implement an immutable data type outcast with the following API: public class Outcast { // constructor takes a WordNet object public Outcast (WordNet wordnet) // given an array of WordNet nouns, return an outcast public String outcast (String[] nouns) // test client (see below) public static void main (String[] args) Corner cases. Assume that the argument to outcast() contains only valid WordNet nouns and that it contains at least two such nouns. Test client. The following test client takes from the command line the name of a synset file, the name of a hypernym file, followed by the names of outcast files, and prints an outcast in each file: public static void main(String[] args) { WordNet wordnet = new WordNet(args[0], args[1]); Outcast outcast = new Outcast(wordnet); for (int t = 2; t < args.length; t++) { In in = new In(args[t]); String[] nouns = in.readAllStrings(); StdOut.println(args[t] + ": " + outcast.outcast(nouns)); } } Here is a sample execution: ~/Desktop/wordnet> more outcast5.txt horse zebra cat bear table ~/Desktop/wordnet> more outcast8.txt water soda bed orange_juice milk apple_juice tea coffee ~/Desktop/wordnet> more outcast11.txt apple pear peach banana lime lemon blueberry strawberry mango watermelon potato ~/Desktop/wordnet> java-algs4 Outcast synsets.txt hypernyms.txt outcast5.txt outcast8.txt outcast11.txt outcast5.txt: table outcast8.txt: bed outcast11.txt: potato
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education