Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have decided to apply for a programming position at a local bank. As part of their hiring process they ask that you write a

You have decided to apply for a programming position at a local bank. As part of their hiring process they ask that you write a program to validate Charge Card Account numbers in an effort to curtail falsified accounts. 

Your first requirement is to populate a single-dimensional array with the following numbers (18 of them, populated in this order): 

5658845 4520125 7895122 8777541 8451277 1302850 8080152 4562555 5552012 

5050552 7825877 1250255 1005231 6545231 3852085 7576651 7881200 4581002 

Once you have the array populated with these values (in the order they are listed), the bank wants you to code the rest of the program to ask the user for an account number and then, using a BINARY search function, determine if the account number is valid (it will be valid if it is in the list of values above). Before you can execute a binary search function, you MUST create another function that will sort the values in the array in either ascending or descending order (See paragraph below, I recommend ascending). Then return from the binary search function whether the account number is valid or not. 

If the value is valid, the program will display an "Account number is valid" message. If it is not valid, the program will display an "Account number is not valid, contact security" message. The program will then ask the user if they want to validate another account number, and if they answer Yes, the process will continue. If the user chooses not to continue, the program will display a "Thank you for using ABC Bank's Charge Card Account Verification System" message and then terminate. 

In order to execute a binary search, recall that the array must FIRST be sorted in ascending (or descending) order BEFORE you attempt to conduct the binary search. Pass the unsorted array into a function that completes a bubble sort to get the array in the correct order. As part of your program development, you might want to then display the contents of the array to verify that your sort is working BEFORE you attempt the search portion of the program. You can then remove the display of the array contents and move on to the binary searching portion.

Step by Step Solution

3.44 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

include include using namespace std void Sortint arr int n int i j int temp for i ... 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

Financial Accounting A User Perspective

Authors: Robert E Hoskin, Maureen R Fizzell, Donald C Cherry

6th Canadian Edition

470676604, 978-0470676608

More Books

Students also viewed these Accounting questions

Question

What are the degrees of freedom associated with ????e.

Answered: 1 week ago