Write a program that will validate credit card transaction

Assignment Help Computer Engineering
Reference no: EM132111982

Purpose

To practice UDP programming, including the use of the socket, bind, sendto, and recvfrom system calls.

Assignment

Write a C++ program that will validate (imaginary) credit card transaction information by querying to a UDP server. You will be writing the client, and the server's address and port information will be provided to you.

Program

Implement a C++ program that prompts the user for the details of a credit card transaction.

These details include the name of the card holder, the credit card number, the expiration date, and the dollar amount to be authorized.

The card holder name is a string. The card number must be a 15 or 16 digit number. The expiration date is of the form MM/YYYY (eg. 12/2019). The amount will be a number with two digits after the decimal point.

Your program will send the information to a UDP server in a single datagram containing all of the information spec- ified. The server will respond with a single datagram, containing whether the credit card transaction is valid, and an authorization code.

The UDP datagram sent to the server must contain the card number, expiration date, amount, and card holder name in a colon separated list, for example: "6011 1234 4321 1234:12/2016:543.21:John Doe".

UDP Server Details

The details for the UDP Server will be listed in the assignment listing on BlackBoard.

Error Checking

Your program must check whether the name, credit card, expiration date, and amount are well formed. If they are not, prompt the user for them again.

Name can be any string less than 64 characters. Credit card number must be either 15 or 16 digits, with the possibil- ity that spaces may be used between numbers to separate them into groups. The expiration date must be of the form MM/YYYY (obviously MM should be between 01 and 12). The amount can be any number digits followed by a decimal point and then two more digits.

Example Run

% ./assign7
Welcome to the Credit Card transaction verification utility:
Enter card holder name (or quit): John Doe
Enter CC number: 3724 531039 23000
Enter expiration: 10/2016
Enter amount: 12.00
Wed Nov 14 10:34:05 CST 2012: American Express: 3715 199624 21012 is valid: authorization code: 198806 for $12.00 Enter card holder name (or quit): Susan Maloney
Enter CC number: 6011 1234 4321 1234
Enter expiration: 12/16

... expiration date invalid, try again: 12/2014
Enter amount: 1234.56
Wed Nov 14 10:35:45 CST 2012: Discover: 6011 1234 4321 1234 is valid: authorization code: 386489 for $1234.56 Enter card holder name (or quit): Manny Diaz
Enter CC number: 6011432112344321
Enter expiration: 01/2018
Enter amount: forty

... amount invalid, try again: 44
... amount invalid, try again: 44.44
Wed Nov 14 10:36:33 CST 2012: Discover: 6011432112344321: checksum incorrect Enter card holder name (or quit): quit
%

Reference no: EM132111982

Questions Cloud

What are some of the challenge of dealing with diversity : What are some of the challenge of dealing with diversity? Describe what you see as the largest need for competencies for HR professionals in future years.
Prompt the user to input five pairs of numbers : Implement the "Output roster" menu option, printing the players in the order of their jersey numbers, as in part (1) above.
Write a program that uses all of your functions : Write a program that uses all of your functions from above to carry out an RSA key generation, encryption, and decryption.
Develop a text-based interface that allows you to test : Develop a text-based interface that allows you to test the ATM and bank classes without being distracted by GUI programming
Write a program that will validate credit card transaction : Implement a C++ program that prompts the user for the details of a credit card transaction.
The first ten elements in the periodic table : Create a list of tuples that holds the information about the first 10 elements in the periodic table .
Find the sub game perfect nash equilibrium : Find the sub game perfect Nash equilibrium of this two-stage game - discuss how the Trump tariff affects (i) the prices of smartphones, (ii) the market share
Write a program that will prompt the user for temperature : Add this static method to your program. Use the output of the cToF conversion method as the input for the fToC conversion method.
Write a string expression whose value is the string : Write a string expression whose value is the string equivalent of each these variables joined by a single period .

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd