Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

HOMEWORK ASSIGNMENT #3 DUE: Friday, May 7, 2010 Pr !ra""i#! a#d A$! ri%&"' S(ri#!

S)")'%)r, 2010 T %a$ Mar*': 10


1. Homework submission instructions: (marks: 2) a. Copy all required files (hw3.cpp) for this homework into a folder named yourfirstname_yourlastname_syndicate. For example muhammad_ali_A b. Zip this folder and send it to email uzma@ceme.nust.edu.pk y !!"#$pm Friday% &ay '% ()!). c. *he email su +ect must e hw3 yourfistname yourlastname yourroll# syndicate. For example" hw3 muhammad ali !(3 A d. Ignoring even one of the instructions above will result in 0 out of 2 marks assi,ned to these instructions. 2. Overview -e intend you to oth .alidate and create typical !# and !/ di,it credit card num ers elon,in, to 012A% &A2*34CA45 and A&341CA6 3784322. 8lease take in the information pro.ided for purely academic and entertainment reasons. 1 must mention here that usin, mathematically ,enerated credit card num ers to purchase products o.er the 1nternet or in real life is not only unethical and hi,hly ille,al9 it:s also not technolo,ically possi le yet to ,enerate expiry date alon, with C0 code which is a solutely necessary to carry out any kind of transaction. *his assi,nment in short will ,i.e you concept of al,orithms that use computation power as a method of ,i.in, security and lastly how hi,h the stakes can e if someone implements a faulty al,orithm. 3. Requirements (marks: 8) 1. 2. 8ro,ram should ask user whether he;she wants to ,enerate a credit card (CC) num er or .erify a credit card num er. 1n case user selects an option of ,eneratin, CC num er. 8ro,ram should then ask the type if credit card num er to e ,enerated (0isa% &aster% 5isco.ery or Amex). <our pro,ram should then use the =uhn Al,orithm and rand() function to ,enerate a .alid credit card num er of the selected type. 4emem er the CC num er should always e different e.ery time the user wants to ,enerate a CC num er. >se a com ination of system time and random num ers to ensure that ,enerated credit card num er is always unique. Check this link for more information on how to retrie.e system time http://www.codersource.net/c/c-tutorials/c-date-and-time.aspx 1n case user selects to .erify the CC num er% the 8ro,ram should ask the user to enter a credit card num er and then .erify whether the entered credit card num er is .alid or not. 8ro,ram should also tell the user whether the entered credit card num er is a &aster% 5isco.er% American 3xpress or a 0isa.

3. ?.

Hint: 8lease ,o and read the detailed description of =uhn Al,orithm from the followin, link" http://www.moneybluebook.com/how-to-create-and-generate- alid-credit-card-numbers/ 5etails of rand() function can e found out from the followin, link"

http://www.cplusplus.com/re!erence/clibrary/cstdlib/rand/

4. Sample run -hat do you want to do@ !. Aenerate a credit card num er. (. 0erify a credit card num er. 3. 3xit. 3nter your choice (press !% ( or 3)" ! -hich type of Credit Card num er do you want to ,enerate@ !. American 3xpress (. &aster Card 3. 0isa ?. 5isco.ery #. Ao ack to main menu 3nter your choice (press !% (% 3% ? or #)" 3 Aenerated 0isa card num er is ?(!'//!3'#'B)$/( -hich type of Credit Card num er do you want to ,enerate@ !. American 3xpress (. &aster Card 3. 0isa ?. 5isco.ery #. Ao ack to main menu 3nter your choice (press !% (% 3% ? or #)" # -hat do you want to do@ !. Aenerate a credit card num er. (. 0erify a credit card num er. 3. 3xit. 3nter your choice (press !% ( or 3)" 3 (8ro,ram should exit now) *he num er used a o.e is an expired Credit Card num er and can only e used for testin, and .alidation only. -ron, entries of this or any credit card num er at any we site; usiness are recorded alon, with 18 address and identity of the user y cy er crime a,encies. 2uch an act is punisha le y law in 8akistan and a road.

You might also like