Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

you will be implementing a Lexicon class. This Lexicon class will maintain a list of words, and the user will be able to query the

you will be implementing a Lexicon class. This Lexicon class will maintain a list of words, and the user will be able to query the Lexicon as to whether or not a word is in the Lexicon, the user will be able to add words to the Lexicon, or to modify a word in the Lexicon. Constructors: Lexicon(); A constructor that allows the user to create an empty Lexicon: Lexicon(const string& fileName); A constructor that opens the file associated with fileName, and stores all of the words in the file in the Lexicon. If the file doesnt exist, an exception should be thrown. (N.B. The ifstream constructor takes a C-style string as a parameter to open the file and not a C++ string object. To get the C-string equivalent of any given C++ string, use the member function c_str(). For example, to get the C-string equivalent of fileName, call fileName.c_str().) Operations: bool containsWord(const string& word); returns true if word is in the Lexicon, and false otherwise. list startWith(char ch); returns a list a of words that start with a particular letter, ch. list startWith(const string& p returns a list of words that start with prefix. list endWith(char ch); returns a list of words that end with a particular character, ch. list endWith(const string& suffix); returns a list of words that end with suffix. void addWord(const string& str); Adds str to the Lexicon if it is not there already. If it is there already, do nothing. void updateWord(const string& target, const string& replacement); Changes the spelling of target to become replacement. Operators: friend bool operator==(const Lexicon& d1, const Lexicon& d2); returns true iff d1 and d2 contain the same words, not necessarily in the same order. (N.B. be careful here. You can not just assume that you can compare the lexicons word by word, since they may not be stored in the same order.) friend operator <<(ostream& os, const Lexicon& d); Outputs the content of the Lexicon (in any order). Please submit Lexicon.h, Lexicon.cpp, and useLexicon.cpp files. Also, please use comments to document your code. These homeworks will become more and more complicated, and if I cant figure out what your intuition is in solving these problems, I cant give credit. I have provided 2 text files with the same lexicon, but I ran a program that has randomly permuted the words such that they are no longer listed in sorted order. When these files have been stored into Lexicon objects, your == function should return true.

TEXT1

-----------------------------------

abaptiston abidance abilao abdicant aberrating abac abbacomes abient aam abacaxi abhors abbreviating abilla abenteric abayah abducent 're abecedarian abets ab abattises abarthrosis abear aals abates abandonedly abactor aberrantly aberr abdaria abhenrys abalienate 's abelite abietene abbotric 7th abbotships abarticular abastardize abider abilitable abduct abbeys abidi abbreviations abirritate abasedness abaised aarrgh abdominals abduction abhenries abducing abelmosk 'slight abasers aberrometer abaddon abandonments 'slife abduced abeles abdicate abasic 'd abamps abalone abhorrible abase abdomen 'twas abhorrer abdal abcess abbreviatable abdicates 'un 'strewth abiogenist abc abbacy abdominothoracic abilities abides abetter aardvarks abandoner abey abalienated 'snails abarticulation abede abbreviation abiogenetical abigails 5th abbess abacas abassi abaka abdomina abiogenetically aback abaton abbreviated abbatical abdominogenital abbreviatory abaiser abeigh abietic abetting 'slid abend abbott abdominovesical 3rd abietite abele abalienating abattised abdicator abidal abating abdest aalii abasio aberuncate abiegh abdominales abiding a abhorrers 4th abetment aardwolves aah abacisci abir abib abaft abamp abecedary 'prentice 'em aberrations abalienation abirritant abiogenetic abaissed abbreviators abirritation abhiseka abashments a's abba abaxial abdicated 2nd abhor abevacuation abject abbotcies abaisse abiliment abasia abdicating abdominovaginal aberuncator abandoners 'sheart 'mid abiders abietineous abasing 9th abased abacus abamperes abit abecedarians abaptistum abirritative abastard abeyancy abdominalia 10th abdominoscope abilo abiology abhominable abietin abiosis abettors abash abdomen's abdali abandonable 'twould abatis aberduvine abecedarium abettals aberrator aahed abas aaa abhorrences abearance abigei abjectedness abbogada aberdavine abcissa abettor abiologically abiotrophy abacinate abashment abilene abbate abada abby abelmosks abdominocentesis abductor's abducens aberration ability abessive abboccato abidingly abdom abbreviator abducts abduce abiotic abatised abampere abdominocystic abasedly abatable abbotnullius abature aberrative abdominal abidances abiston abatage abbesses abdominalian abaction 've abask 'sfoot abetments aberrancies abbots abbatial abbozzo abdominous abducentes abiogeny abbe abhenry abelian abandon abioses abashedness 'twere abbreviately abelmusk 1st abime abashes abiogenesist abecedaire abandum aargh abdominoposterior 'sblood abed abases aberrate aaronic abiogenesis abhinaya abel aberrancy abaculi abeltree abbreviature aahs abacate abbotship abattu abided abbot's abbey abductores aasvogel aahing abirritating abhorrence abattoir &c 'tween abiotical abattue abet a/c abegge 'mongst abbreviates abandoning abaculus abdat aaliis abashing abapical aberroscope abator abandonment aberrant abintestate abducted 'm abbotcy abeyance abiogeneses abdications 2 abattage abernethy abannition aasvogels aardwolf abhorrently abhorrent abducting abhorring abditive abadengo 'twixt aa aarrghh abigeus abidden abashlessly abdicative aberrants abd abfarad abalones abbrev abanga abesse abacuses abdicable abetted abashedly aberdevine abators 'll abacterial abate abbroachment 'til abattoirs abbot 'twill ability's abadia abbes aberrated abacay abaisance abecedarius abdominohysterotomy abigail abaters 6th abandonee abbasid abave abiotically abakas abdomens aas abatement aba abduction's abfarads 1080 abay abb abacination 8th abated abadejo abactinal abaue aberdeen abeyancies abastral abiuret abigailship abirritated abeyant 'tis a' 'sbodikins abigeat aberrance abbreviate abeam abichite abalation abduces abedge abbest abasias abbatie aal 'shun abiological abductions 't abbasi abattis abiogenous abaciscus abbacies abandons abdominally abashed abasements aband abanet abecedaria abide abaci abbaye abience abdominohysterectomy abbandono abietinic abaca abhorrency abbr abbassi abiotrophic abjections a1 abeyances abductors abaze aardvark abcoulomb abbevillian abatic abdication abatises abaxile abacist aberrational abatjours abbas abacli 'midst abdominocardiac abactinally abecedaries abends abdominoscopy abasement abetters abaff abbey's abietate abettal 'sdeath abandoned abbeystead abater abacot abhorred abaser abidingness aaron abbeystede abditory abashless abatements abepithymia abatjour abjection abductor abdominoanterior 

TEXT2

-----------------------------------------------------

abet abasement abdominal abdominalian abatjours abators 'll abbey's abbreviate aa abastard abaculus abilo abdominoposterior 2 abaze abattoirs 1st abarticular abettors abbreviation abbreviatable abacay abdicable abaptiston abba a abecedaria abetments abdominoanterior abdominocardiac abbassi 'em 1080 9th aberrations abattu abbreviatory a's abbacies abbeystead abdicate abannition abdali abanga abiogenist abbaye abattue aback 6th abashment abducentes 'twould abetter abbasid aberdeen abbrev abatable abacate abas abashless abidances abasers aardwolves aaa abaff 'mongst aba abdomina abattis abatjour abhenries abioses abelite abaton abasic abed abductores ability's abditive abiogenesis abandoning abbotcies aberrance abeyance abesse abides abider abecedarium aahed 'twas abbot's abandonments abalones aberroscope abattises abattage abducting abampere abaction abaser aaronic abalation abend abapical abirritated abirritate abandoner abeltree abintestate abiegh abased abasia ability abjectedness abasio abiogenetical abatised abacus abietate ab abaxial abbotnullius abd 'un abaiser abbandono 'sheart abel abhorrible abalienate aberdevine abevacuation abhenry 'sblood abaue abamps abductions abashments abash abdom abacterial abfarad abiotically 8th abashedly abakas abhominable abbots abetted abhorred abient abience abalienating abaisance abashed aah abdominothoracic abdominous abdications abdominocystic abbeystede abduction 'strewth abegge abbreviated abduce abeigh abbr 'twixt abassi abilities abator abaca 'tis abandonedly abigeus abbatial abeyant abashing abaka abdicated abducts aals abdomen's abilitable aberrometer 'midst abhors abhiseka abhorrently 'snails abate aberrated abdicative abay abaisse abdominocentesis abactor abada abilao abacuses abends aberuncate abaculi abasedly abamp abashes abbacy abbreviating abacli abelmusk aberrancy 'sdeath abecedaries abietin abietite abattised abduces abbate abaptistum abattoir abecedarius aberduvine abbotships 's &c abettor aberrantly abacot aband abiosis abdal abbroachment abdominoscope abatement abacaxi aberrate abetting abboccato abiotrophy abc abdominogenital abdominals aberr abigei abaciscus aaron aasvogel abiders aal 'shun abigeat 3rd abduced abelmosks abdaria aberrating abecedarian aardvarks abecedarians abactinally abbest abdicates abases abjections abetment aberrancies abets abdomen abiotrophic abbreviators abarthrosis abidance 'slife 'twill abedge abiogenetically abbevillian 'slight abhorrency abbozzo aardwolf abhinaya abiological abbreviations abdominovaginal aberdavine abbacomes 'twere aahing abiston abib abbey abbreviator a' abbesses a1 abbreviature abiliment aalii abashedness abiogeny abidal abhor abase abjection abandoned aarrghh abbeys abigailship abirritative abbotship abducing abelian abbas abatements 'mid abandum abasements abductor's abaissed abdest abditory abiology 't abidi abey aberration 'til abbatie abit abettal abayah abdominalia abactinal abdicator abecedaire 'prentice abcess abduct abasing abiologically aberrant abadengo abadia abalienated abernethy aberrative abiogenous abiotic abasedness abigails 5th abalienation 'tween 4th abhenrys aarrgh abhorrences abbreviately aberrator abject abamperes abave abandons aahs abducens abdominales abasias abiogeneses abbasi abidingly abeles 'd abbot aargh abated abbatical abdicating abask abietineous 'slid abfarads abdominohysterectomy abduction's 're abby abettals abietic abdat abdominoscopy abb abele abecedary abaxile abbotric 'm abatis abadejo abided abandoners abandonable abatage 'sfoot abirritating 'sbodikins aardvark aberrational abducted abede abcissa abac abhorrent abastardize 7th abirritant abandonment abhorrer aaliis abalone abandonee abhorrers abbe abigail abilla abanet aas abeyancy abdication abacist abastral abbott abaci abietinic a/c 2nd abiogenesist abbogada abeyancies 've abime abbreviates abenteric abatic abhorring abhorrence abdominovesical abdomens abelmosk abater abbess abiding abessive abatises abbes abaft aam abetters abir abiogenetic abductor abirritation abide aberuncator abichite abacinate aasvogels abidden abacination abacisci abbotcy abcoulomb abidingness abating abature abarticulation abashlessly abdicant abepithymia abeyances abducent abates abeam abiuret abearance abdominohysterotomy abear abdominally 10th abductors abietene abandon abiotical abilene aberrants abaters abaddon abacas abaised 

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

More Books

Students also viewed these Databases questions

Question

Can workers be trained in ethics? How? Defend your answer.

Answered: 1 week ago