You have been hired by the SFPD fraud unit to help detect credit card fraud.  They have given you a list of 20 stolen credit card numbers, and want you to write a program that can detect if someone is attempting to use one of these credit card numbers at the local Target store. Your program should first read in a list of credit card numbers from a file into an array, and ask the user for a credit card number they would like to use.  Then, search the array of credit card numbers to see if the credit card number is in the list. To simplify, we will use a 6 digit credit card number, e.g. 424238.  Your list of stolen credit card numbers must be stored in an array of 20 ints. You can get a list from my website and read it in to initialize your array, it is sorted from lowest to highest card number.  To get the list into your hills directory, you can use the wget command from the hills prompt: wget http://fog.ccsf.edu/~mluttrel/cs110b/cards.txt After running this command from the hills prompt, the file cards.txt will be in your hills directory, and your C++ program can use the file input code discussed in this module to read it into an array.  If you are using another development environment, like repl.it, Xcode, etc. you will need to research how to add text files to your project and use them. Get this working with linear search first.  If you have time, do a binary search function.  Think about the number of comparisons each one does.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

You have been hired by the SFPD fraud unit to help detect credit card fraud.  They have given you a list of 20 stolen credit card numbers, and want you to write a program that can detect if someone is attempting to use one of these credit card numbers at the local Target store.
Your program should first read in a list of credit card numbers from a file into an array, and ask the user for a credit card number they would like to use.  Then, search the array of credit card numbers to see if the credit card number is in the list.

To simplify, we will use a 6 digit credit card number, e.g. 424238.  Your list of stolen credit card numbers must be stored in an array of 20 ints. You can get a list from my website and read it in to initialize your array, it is sorted from lowest to highest card number.  To get the list into your hills directory, you can use the wget command from the hills prompt:

wget http://fog.ccsf.edu/~mluttrel/cs110b/cards.txt

After running this command from the hills prompt, the file cards.txt will be in your hills directory, and your C++ program can use the file input code discussed in this module to read it into an array.  If you are using another development environment, like repl.it, Xcode, etc. you will need to research how to add text files to your project and use them.

Get this working with linear search first.  If you have time, do a binary search function.  Think about the number of comparisons each one does.

 

 

Question 1
You have been hired by the SFPD fraud unit to help detect credit card fraud. They have given you a list of 20 stolen credit card numbers, and want you to
write a program that can detect if someone is attempting to use one of these credit card numbers at the local Target store.
Your program should first read in a list of credit card numbers from a file into an array, and ask the user for a credit card number they would like to use.
Then, search the array of credit card numbers to see if the credit card number is in the list.
To simplify, we will use a 6 digit credit card number, e.g. 424238. Your list of stolen credit card numbers must be stored in an array of 20 ints. You can get a
list from my website and read it in to initialize your array, it is sorted from lowest to highest card number. To get the list into your hills directory, you can use
the wget command from the hills prompt:
wget http://fog.ccsf.edu/~mluttrel/cs110b/cards.txt
After running this command from the hills prompt, the file cards.txt will be in your hills directory, and your C++ program can use the file input code discussed
in this module to read it into an array. If you are using another development environment, like repl.it, Xcode, etc. you will need to research how to add text
files to your project and use them.
Get this working with linear search fırst. If you have time, do a binary search function. Think about the number of comparisons each one does.
Transcribed Image Text:Question 1 You have been hired by the SFPD fraud unit to help detect credit card fraud. They have given you a list of 20 stolen credit card numbers, and want you to write a program that can detect if someone is attempting to use one of these credit card numbers at the local Target store. Your program should first read in a list of credit card numbers from a file into an array, and ask the user for a credit card number they would like to use. Then, search the array of credit card numbers to see if the credit card number is in the list. To simplify, we will use a 6 digit credit card number, e.g. 424238. Your list of stolen credit card numbers must be stored in an array of 20 ints. You can get a list from my website and read it in to initialize your array, it is sorted from lowest to highest card number. To get the list into your hills directory, you can use the wget command from the hills prompt: wget http://fog.ccsf.edu/~mluttrel/cs110b/cards.txt After running this command from the hills prompt, the file cards.txt will be in your hills directory, and your C++ program can use the file input code discussed in this module to read it into an array. If you are using another development environment, like repl.it, Xcode, etc. you will need to research how to add text files to your project and use them. Get this working with linear search fırst. If you have time, do a binary search function. Think about the number of comparisons each one does.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
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