Purchase Solution

Charge Account in Java

Not what you're looking for?

Ask Custom Question

Create a class with a method that accepts a charge card account number as its argument. The method should determine whether the number is valid by comparing it with a list of valid charge card account numbers. The comparison should be accomplished using a search. If the account number to be checked is in the list of valid account numbers, the method should return true and if the number is not in the list, the method should return false.
The valid account numbers are stored in a file named valid_accounts.txt. A copy of this file should have accompanied this exam. You should create a method that will read the valid charge card account number list and return an array or arrayList object with the 7 digit integer values stored in the file (none of the numbers start with the digit zero).
The account numbers to be checked are stored in a file named accounts_to_check.txt. A copy of this file should have accompanied this exam. You should use the same method as above that will read the charge card account number list and return an array or arrayList object with the 7 digit integer values stored in the file (none of the numbers start with the digit zero).
You should also create a method that takes an array or arrayList object, arranges the charge card account numbers in ascending order and returns the sorted array or ArrayList object.
Demonstrate your class methods in a driver program by reading the charge card account numbers to be checked for validity from a file named accounts_to_check.txt, testing to see if each number that is in the file is valid, and displaying the result of that check in a report. Consider your output a report that someone could easily verify against a sorted valid accounts list. Output two additional reports: A sorted valid accounts list and a sorted accounts to check list.
If you use an ArrayList, you will have to do some independent research to accomplish this solution. Be sure to document any classes or methods you use outside the scope of chapters 1-8 in the book.
The files valid_accounts.txt and accounts_to_check.txt accompany this Final Exam document.
valid_accounts.txt:

9219306
7569177
4256928
4364059
6221744
3176698
7187438
4484503
8937630
6389278

3933096
7342775
2877438
5426950
9982031
4654335
5045697
5034644
6989075
8314073

1613911
1335305
6196903
8449641
1545292
4906480
1336532
3124745
7122978
1800843

7934692
6551425
8461254
1559757
4192728
1025121
1417918
1751466
5200307
4082692

3509247
7145465
9860616
1128882
2396421
5390896
2311287
3545377
1886054
6429595

accounts_to_check.txt:
2197966
4256928
1075220
2877438
4378016

8314073
2073673
8449641
8073168
1800843

4119317
1025121
8282263
4082692
5950660

2396421
5434498
9152307
3545377
8039204

1336532
6135520
8461254
4654335
7187438

Purchase this Solution

Solution Summary

Charge accounts in Java are examined.

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic Networking Questions

This quiz consists of some basic networking questions.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

C++ Operators

This quiz tests a student's knowledge about C++ operators.