The file transactions.txt contains rows of transactions. Each transaction (row) consists of a start month, end month and name. Each of these three values is a String. In the following tasks you are asked to read and store the transactions from the file and determine if there are any duplicate transactions. A transaction is a duplicate if all three values are the same as the three values of any other transaction. a. add code to your main method that reads the content of transactions.txt and stores it in a two-dimensional String array. The name of the String array is your choice. Note that you may not assume that the number of rows in transactions.txt will always be the same. However, you may assume that there will always be three String values on a single row. The first dimension of your two-dimensional array must be resized dynamically each time a new record is read (Hint: we did this in class with a single dimensional array and this is very, very similar). Your code will be evaluated with rows in transaction.txt that you have not seen. b. Create a method named checkForDuplicates that returns a boolean and accepts a twodimensional ‘String1 array as an argument. c. In checkForDuplicates check to see if any two rows of the two-dimensinal array provided as an argument to the method are the same. You must use at least one enhanced for-loop in this method. Return true if ANY two equivalent rows are found and false otherwise. d. In the main method call checkForDuplicates with the two-dimensional array containing the transactions data read from transactions.txt. Print a message to the console indicating whether any duplicate transactions exist in transactions.txt.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

The file transactions.txt contains rows of transactions. Each transaction (row) consists of a start month,
end month and name. Each of these three values is a String.
In the following tasks you are asked to read and store the transactions from the file and determine if there
are any duplicate transactions. A transaction is a duplicate if all three values are the same as the three
values of any other transaction.
a. add code to your main method that reads the content of transactions.txt and stores it
in a two-dimensional String array. The name of the String array is your choice. Note that you may
not assume that the number of rows in transactions.txt will always be the same. However, you
may assume that there will always be three String values on a single row. The first dimension of your
two-dimensional array must be resized dynamically each time a new record is read (Hint: we did this
in class with a single dimensional array and this is very, very similar). Your code will be evaluated
with rows in transaction.txt that you have not seen.
b. Create a method named checkForDuplicates that returns a boolean and accepts a twodimensional ‘String1 array as an argument.
c. In checkForDuplicates check to see if any two rows of the two-dimensinal array provided as an
argument to the method are the same. You must use at least one enhanced for-loop in this method.
Return true if ANY two equivalent rows are found and false otherwise.
d. In the main method call checkForDuplicates with the two-dimensional array containing
the transactions data read from transactions.txt. Print a message to the console indicating whether
any duplicate transactions exist in transactions.txt.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,