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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education