Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objectives: Arrays and Array Lists are both used in java. Using one or the other can be beneficial between what tasks you are trying to
Objectives: Arrays and Array Lists are both used in java. Using one or the other can be
beneficial between what tasks you are trying to achieve. After completing this
assignment, students will be able to:
Declare an Array and Array List
Implement storage of data into Array and Array List
Managing data in an Array and Array List
Task Description: A dictionary company wants to have a program to keep track of all
words in their dictionary that are palindromes. A palindrome is a word or string that is
written the same way forward and backward. Examples of this would be kayakrefer
rotator and pop The company wants to be able to give the program a text file full of
words wordstxt and wants a result displayed in the console and a file written with
only palindromes arraypalindrometxt and arrayListpalindrometxt
As a programmer, you want to determine if creating this program will be more efficient
as an array or an array list. You decide to experiment by storing data in an Array and an
ArrayList.
Create methods: readFile appendToFile determinePalindrome
and getSizeFile
readFile: Read in the file and store words into both data structures.
appendToFile: Append palindrome words to the end of each file.
determinePalindrome: checks if a word is a palindrome or not.
getSizeFile: Gets the number of lines in the file. Used for array size.
Step 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