Home / Expert Answers / Computer Science / file1-wordwordwordscheduletestswordschedulewebcontentwebcontentfile1-v3-rememberspicygiftedwatchmea-pa582

(Solved): file1:wordwordwordscheduletestswordschedulewebcontentwebcontentfile1_v3:rememberspicygiftedwatchmea ...



student submitted image, transcription available belowstudent submitted image, transcription available belowstudent submitted image, transcription available belowstudent submitted image, transcription available belowstudent submitted image, transcription available belowstudent submitted image, transcription available belowstudent submitted image, transcription available below

file1:

word
word
word
schedule
tests
word
schedule
webcontent
webcontent

file1_v3:

remember
spicy
gifted
watch
meat
close
language
caring
poised
hop
quilt
calculator
trail
pat
spell
temper
harsh
evanescent
sugar
slip
birds
sin
baby
witty
hesitant
bury
leather
loaf
aspiring
attract
separate
empty
two
bomb
laborer
mice
representative
bell
songs
fang
pick
nose
insurance
onerous
doctor
stretch
big
godly
goofy
tickle
yam
theory
bell
paper
listen
profuse
nest
notebook
scrape
determined
victorious
pancake
nest
jelly
faulty
kill
nest
walk
bell
bear
nest
dinner
wiggly
long
laughable
enchanting
flood
prevent
hill
apparel
pat
stranger
crowded
defeated
classy
bell
inconclusive
dime
market
victorious
arithmetic
dime
turn
crayon
receive
spiky
leg
oceanic
grieving
purring
terrible
seed
sore
difficult
north
inquisitive
endurable
willing
wheel
phone
shake
disagreeable
bent
tax
cow
living
rebel
fit
tenuous
face
crazy
friends
foamy
leather
sink
slow
spurious
fabulous
long-term
moan
remember
jog
oval
look
painful
nonchalant
muddled
health
garrulous
nonchalant
muddled
health
garrulous
nonchalant
muddled
health
garrulous
vanish
gray
week
absent
jam
barbarous
dime
high
smoggy
labored
excited
ask
box
flame
disappear
quartz
own
plastic
real
listen
wiggly
impulse
fireman
close
absent
nonchalant
foamy
caring

file2:

siteinfo
tests
schedule
siteinfo
tests
schedule
siteinfo
lessons
lessons
lessons
roster
discussions

file2_v3:

bell
bell
bell
remember
spicy
gifted

temper
harsh
nest
mice
representative
bell
lackadaisical


paper
nest
listen
bell
profuse
nest
nest
notebook
yam
excited
nest
learn
jar
offer
nest
theory
soup
perform
future
playground
vanish

pot
lumpy
stretch
outrageous
crash
intend
terrify
important

turn

face
foamy
theory
yam
garrulous
dime

labored
watch
muddled
nonchalant
foamy
caring
nonchalant

health
garrulous
health
nonchalant

file3:

tolga

file3_v3:

spray
watch
yam
excited mother
learn
jar
offer
theory
soup
perform
future
playground
vanish
pot
lumpy
stretch
outrageous
crash
intend
nest
nest
nest
nest
nest
bell
bell
bell


terrify
important
pathetic
sturdy
lackadaisical
doubtful
grass
rule
trees
flavor
voiceless

file4:

webcontent lesson
roaster roster discussions discussion tests

file4_v3:

school
skip



account
divide
rotten

file5:

gradebook email lessons
webcontent
webcontent
email
gradebook
gradebook
email
lessons
assignments
syllabus syllabus
email
resources

The aim of this THE is to practice on stack structures. You will implement a program for finding the common words of two given files. It might seem like a trivial CS201 task at first but you must do this by using dynamic stacks. Input to Your Program Your program will first ask for two file names. Afterwards, it will ask an option question, to which the user can only respond with a \" 1 \" or \" 2 \". Format of the Inputs At the very beginning, your program will ask for the name of the first input file. Your program should keep asking the same question until a valid file name is given. The same procedure shall be applied for the second file name as well. Once you get both file names correctly, you can start parsing the information out of the files.\r\nThe files may consist of more than one line and there might be empty lines as well. Besides, the words within the files might be separated by spaces, tabs or multiple of these. However, there won't be any punctuation marks and/or digits within the files. They will just consist of a bunch of words. Lastly, your program will ask the user to choose the option \" 1 \" or \" 2 \". Option \" 1 \" means that the common words will be displayed in the order that they appear in the first file, whereas Option \" 2 \" means that they will be displayed in the order that they appear in the second file. If the option is invalid, your program should print an appropriate error message and ask again until a valid option is entered by the user. Details of these operations can be inspected in the Sample Runs section. Data Structure to be Used You must use dynamic stacks for this THE. Indeed, you are not allowed to use any other aggregate data type other than dynamic stacks (array, vector, queue, static stack etc. may not be used anywhere in your code). Moreover, you are not allowed to read the files more than once. You need to think on how to utilize dynamic stacks to store linear information. We inspect your codes other than testing them with test cases; so any attempt of using an alternative data structure or reading the files more than once will be easily spotted and your grade will be set to zero. Note: A dynamic stack is a stack which is implemented in a dynamic linked list with dynamic memory allocation and deallocation operations. You are not allowed to implement a static stack which uses arrays or vectors internally, for this THE. Details of the Tasks and Outputs of Your Program Your program should find the words that appear in both of the files. For this, your program should first read the files and store the words in dynamic stack(s). You may want to design your dynamic stack class in a way that you can store the occurrences of the words along with them, because your program should be displaying that information in the end as well.\r\nDepending on the user's choice, you may display the common words in two different orders. If the user chooses \" 1 \", your program will display the common words in the order that they appear in the first file. If option \" 2 \" is chosen, the same will apply for the second file. Keeping the information in stacks will help you not to lose track of the order of those words in the files. In the end, your program will display the words which occur in both of the files and their minimum occurrence count (i.e if a word occurs 5 times in a file and 3 times in another file, you should display that the word occurs at least 3 times). The detail is given in Sample Runs. You already have an implementation of the DynIntStack class that you know from the lectures; however this class is not fully suitable for your task. You should be deciding on what kind of information you want to store in your dynamic stacks and edit the class methods and such accordingly. Moreover, you must implement a destructor for the dynamic stack class such that it will deallocate the dynamically created memory for that dynamic stack object. You are encouraged to carefully check the sample runs as they complement the textual description, demonstrate different cases that your code should handle, and they also show the expected behavior of your program. Sample Runs Below, we provide some sample runs of the program that you will develop. The italic and bold phrases are the standard inputs (cin) taken from the user (i.e., like this). You have to display the required information in the same order and with the same words as here. Sample Run 1 This program finds the common words of two files using stacks. Enter the first file name: file Enter the first file name: incorrect Enter the first file name:\r\nfile1_v3.txt Enter the second file name: file Enter the second file name: invalid Enter the second file name: file2_v3.txt Choose with respect to which file the result will be sorted to (1: first file, 2: second file): 1 The word \"remember\" occurred at least 1 time(s) in both files. The word \"spicy\" occurred at least 1 time(s) in both files. The word \"gifted\" occurred at least 1 time(s) in both files. The word \"watch\" occurred at least 1 time(s) in both files. The word \"caring\" occurred at least 1 time(s) in both files. The word \"temper\" occurred at least 1 time(s) in both files. The word \"harsh\" occurred at least 1 time(s) in both files. The word \"mice\" occurred at least 1 time(s) in both files. The word \"representative\" occurred at least 1 time(s) in both files. The word \"bell\" occurred at least 4 time(s) in both files. The word \"stretch\" occurred at least 1 time(s) in both files. The word \"yam\" occurred at least 1 time(s) in both files. The word \"theory\" occurred at least 1 time(s) in both files. The word \"paper\" occurred at least 1 time(s) in both files. The word \"listen\" occurred at least 1 time(s) in both files. The word \"profuse\" occurred at least 1 time(s) in both files. The word \"nest\" occurred at least 4 time(s) in both files. The word \"notebook\" occurred at least 1 time(s) in both files. The word \"dime\" occurred at least 1 time(s) in both files. The word \"turn\" occurred at least 1 time(s) in both files. The word \"face\" occurred at least 1 time(s) in both files. The word \"foamy\" occurred at least 2 time(s) in both files. The word \"nonchalant\" occurred at least 3 time(s) in both files. The word \"muddled\" occurred at least 1 time(s) in both files. The word \"health\" occurred at least 2 time(s) in both files. The word \"garrulous\" occurred at least 2 time(s) in both files. The word \"vanish\" occurred at least 1 time(s) in both files. The word \"labored\" occurred at least 1 time(s) in both files.\r\nThe word \"excited\" occurred at least 1 time(s) in both files. Sample Run 2 This program finds the common words of two files using stacks. \\( --- \\) Enter the first file name: file2_v3.txt Enter the second file name: file4_v3.txt Choose with respect to which file the result will be sorted to (1: first file, 2: second file): aaa Invalid choice Choose with respect to which file the result will be sorted to (1: first file, 2: second file): 0 Invalid choice Choose with respect to which file the result will be sorted to (1: first file, 2: second file): \\( -1 \\) \\( --- \\) Invalid choice Choose with respect to which file the result will be sorted to (1: first file, 2: second file): 2 Sample Run 3 This program finds the common words of two files using stacks. Enter the first file name: file3_v3.txt Enter the second file name: file2_v3.txt\r\nChoose with respect to which file the result will be sorted to (1: first file, 2: second file): 2 The word \"bell\" occurred at least 3 time(s) in both files. The word \"nest\" occurred at least 5 time(s) in both files. The word \"lackadaisical\" occurred at least 1 time(s) in both files. The word \"yam\" occurred at least 1 time(s) in both files. The word \"excited\" occurred at least 1 time(s) in both files. The word \"learn\" occurred at least 1 time(s) in both files. The word \"jar\" occurred at least 1 time(s) in both files. The word \"offer\" occurred at least 1 time(s) in both files. The word \"theory\" occurred at least 1 time(s) in both files. The word \"soup\" occurred at least 1 time(s) in both files. The word \"perform\" occurred at least 1 time(s) in both files. The word \"future\" occurred at least 1 time(s) in both files. The word \"playground\" occurred at least 1 time(s) in both files. The word \"vanish\" occurred at least 1 time(s) in both files. The word \"pot\" occurred at least 1 time(s) in both files. The word \"lumpy\" occurred at least 1 time(s) in both files. The word \"stretch\" occurred at least 1 time(s) in both files. The word \"outrageous\" occurred at least 1 time(s) in both files. The word \"crash\" occurred at least 1 time(s) in both files. The word \"intend\" occurred at least 1 time(s) in both files. The word \"terrify\" occurred at least 1 time(s) in both files. The word \"important\" occurred at least 1 time(s) in both files. The word \"watch\" occurred at least 1 time(s) in both files. Sample Run 4 This program finds the common words of two files using stacks. Enter the first file name: file3_v3.txt Enter the second file name: file2_v3.txt Choose with respect to which file the result will be sorted to (1: first file, 2: second file): 1\r\nThe word \"watch\" occurred at least 1 time(s) in both files. The word \"yam\" occurred at least 1 time(s) in both files. The word \"excited\" occurred at least 1 time(s) in both files. The word \"learn\" occurred at least 1 time(s) in both files. The word \"jar\" occurred at least 1 time(s) in both files. The word \"offer\" occurred at least 1 time(s) in both files. The word \"theory\" occurred at least 1 time(s) in both files. The word \"soup\" occurred at least 1 time(s) in both files. The word \"perform\" occurred at least 1 time(s) in both files. The word \"future\" occurred at least 1 time(s) in both files. The word \"playground\" occurred at least 1 time(s) in both files. The word \"vanish\" occurred at least 1 time(s) in both files. The word \"pot\" occurred at least 1 time(s) in both files. The word \"lumpy\" occurred at least 1 time(s) in both files. The word \"stretch\" occurred at least 1 time(s) in both files. The word \"outrageous\" occurred at least 1 time(s) in both files. The word \"crash\" occurred at least 1 time(s) in both files. The word \"intend\" occurred at least 1 time(s) in both files. The word \"nest\" occurred at least 5 time(s) in both files. The word \"bell\" occurred at least 3 time(s) in both files. The word \"terrify\" occurred at least 1 time(s) in both files. The word \"important\" occurred at least 1 time(s) in both files. The word \"lackadaisical\" occurred at least 1 time(s) in both files.


We have an Answer from Expert

View Expert Answer

Expert Answer




We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe