Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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. In H4 Q3 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 in H4 Q3 that returns a boolean and accepts a twodimensional Stringl 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 of H4 Q3 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. January February Lowes January March Lowes February June HomeDepot February August Walmart March December Walmart April October Home Depot April September Lowes February August Walmart July December HomeDepot June November HomeDepot

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions