Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a CheckAcc class. This class has three data members: AccNum , type String, representing account number; Name , type string, representing customer name; and

Create a CheckAcc class. This class has three data members: AccNum, type String, representing account number; Name, type string, representing customer name; and Balance, type double, representing account balance.

In the main method, first the following information.

The first object: AccNum: 100, Name: Alice, Balance: 100.00

The second object: AccNum: 120, Name: Bob, Balance: 110.00

The third object: AccNum: 141, Name: Doug, Balance: 90.00

The fourth object: AccNum: 116, Name: Eva, Balance: 100.00

The fifth object: AccNum: 132, Name: Frank, Balance: 80.00

Then create an array AccInfo to store these five objects.

The main method will then call the WriteAcc and ReadAcc methods below. In the main method, you should call ReadAcc to read the AccInfo.txt file specified below, and assign the returned value to NewAccInfo array.

Then this main method should call SortBalanceDesc method to sort the NewAccInfo array based on balance in descending order. Then call the SearchBalance method, and display the result of the SearchBalance method.

Create a WriteAcc method. This method receives a parameter, and the type of this parameter is array of CheckAcc class. This method should write the information stored in objects within the parameter to a delimiter file, separated using comma. Each line in this delimiter file is an object, and comma separates the three fields of an object. Write this file to the work directory of your java code with the name AccInfo.txt

Create a ReadAcc method. This method receives a parameter with type String. This string represents the file name in your work directory. In this method, read information contained in the file (corresponding to the parameter value), and generate CheckAcc objects based on the information from the file. This method should return an array with CheckAcc objects.

Create a SortBalanceDesc method. This method receives a parameter with array with CheckAcc objects, and return an array with CheckAcc objects. The returned array should be a sorted array with CheckAcc objects, with the value of Balance in descending order. You should adapt the Bubble Sort algorithm from slides in this method.

Create a SearchBalance method. This method receives a parameter with array with CheckAcc objects, and return an array with CheckAcc objects. In addition, this method should also request input from user to specify a Balance value. The returned array should contain objects with user-specified Balance value. You should adapt the Binary Search algorithm from slides in this method.

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_2

Step: 3

blur-text-image_3

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions