Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the following program in Java: You are to write a Java program that reads an input file containing a list of words and their
Write the following program in Java:
You are to write a Java program that reads an input file containing a list of words and their synonyms. You will repeatedly ask the user if they want to look up the synonyms of a word, add a new synonym for a word, or quit. Here is a sample run of the program (note that the program is expecting the input file, thesaurus.txt to be in the working directory for the code.): Enter (l)ookup, (a)dd entry, or (aDuit: l Enter word: graphic Result: explicit, descriptive, pictorial, lifelike, vivid Enter (l)ookup, (a)dd entry, or (qDuit: A Enter word: graphic Enter synonym: explicit Error: cannot add entry Enter (l)ookup, (a)dd entry, or (q)uit:l Enter word: hilarious Result: uproarious Enter (l)ookup, (a)dd entry, or(q)uit: a Enter word: Hilarious Enter synonym: very funny Enter (l)ookup, (a)dd entry, or (q)uit:l Enter word: hilarious Result: uproarious, very funny Enter (l)ookup, (a)dd entry, or (q)uit:l Enter word: miniscule Result: miniscule not found Enter (l)ookup, (a)dd entry, or(q)uit: a Enter word: miniscule Enter synonym: very small Enter (l)ookup, (a)dd entry, or(q)uit: IL Enter word: miniscule Result: very small Enter (l)ookup, (a)dd entry, or(q)uit: q You are to write a Java program that reads an input file containing a list of words and their synonyms. You will repeatedly ask the user if they want to look up the synonyms of a word, add a new synonym for a word, or quit. Here is a sample run of the program (note that the program is expecting the input file, thesaurus.txt to be in the working directory for the code.): Enter (l)ookup, (a)dd entry, or (aDuit: l Enter word: graphic Result: explicit, descriptive, pictorial, lifelike, vivid Enter (l)ookup, (a)dd entry, or (qDuit: A Enter word: graphic Enter synonym: explicit Error: cannot add entry Enter (l)ookup, (a)dd entry, or (q)uit:l Enter word: hilarious Result: uproarious Enter (l)ookup, (a)dd entry, or(q)uit: a Enter word: Hilarious Enter synonym: very funny Enter (l)ookup, (a)dd entry, or (q)uit:l Enter word: hilarious Result: uproarious, very funny Enter (l)ookup, (a)dd entry, or (q)uit:l Enter word: miniscule Result: miniscule not found Enter (l)ookup, (a)dd entry, or(q)uit: a Enter word: miniscule Enter synonym: very small Enter (l)ookup, (a)dd entry, or(q)uit: IL Enter word: miniscule Result: very small Enter (l)ookup, (a)dd entry, or(q)uitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started