Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Script Programming/Python:

Transaction Report

In this assignment you will write a program which reads a data file containing information in different formats, validates this data, and prints out a report incorporating this data. The data file contains information about a set of credit card transactions which includes the name of the purchaser, the date of the transaction, the amount of the transaction, and the credit card number. The four values for each transaction will be on a single line separated by colons. Each of these pieces of information might be entered using different possible formats, and you should be able to recognize each. Each of the possible formats are:

• Name - a first name consisting of letters, followed by a space, optionally followed by a middle initial (one letter) that may have a period after it, followed by a space, followed by a last name consisting of letters, optionally followed by a space and one of Sr, Jr, III or IV, with a period possibly after the Sr or Jr.

• Date - (1) the date can be in a text form which is made up of the name of the month, followed by a space and then the day in the month (1 or 2 digits), followed by a comma and a space, followed by the year (4 digits); (2) the date can also be in a numerical form which is made up of the month as a number between one and twelve (1 or 2 digits), followed by a / or -, followed by the day (1 or 2 digits), followed by a / or -, followed by the year (2 or 4 digits - if 2 assume the missing two digits are 20 if the existing digits are 16 or less, and 19 otherwise).

• Amount - the monetary amount is given in the format of an optional leading dollar sign, followed by the dollar amount in digits, optionally followed by a period and 2 digits representing the cents.

• Credit card number - Three types of credit cards may be used: Visa, Master Card and American Express. Each of these has a particular format: Visa numbers are 16 digits long and may be a string of 16 digits without spaces or dashes, or they can be four groups of 4 digits with a space or dash between each group, and the number begins with the digit 4; Master Card numbers have the same formatting for 16 digits, but the number begins either with a value between 51 and 55, or between 2221 and 2720; American Express numbers are 15 digits long and may be a string of 15 digits without spaces or dashes, or they can be three groups of 4, 6 and 5 digits with a space or dash between each group, and the number begins with the value 34 or 37.

Your program should take the name of a data file as a command line argument. After validating it, the data file should be read line by line. Each line should have the contents of the transaction validated and extracted using regular expressions as much as possible. If a data line contains a value that is not properly formatted, an appropriate error message should be displayed about what is wrong and the data for that line should be ignored.

All data that is valid should be organized into a report in the following way: the transactions should be ordered such that those that use American Express cards come first, followed by those that use Master Card, followed by Visa. Within each credit card group, the transactions should be ordered chronologically based on the dates, with those that occur on the same date being ordered alphabetically by the person's last name, and if there are multiple transactions for the same person on that date, they should be ordered by the amount of the transaction.

As the data for a transaction is printed out in this report it should be in a standard format, not in whatever format was entered in the file. This format is:

• Credit Card numbers are listed as separate groups of digits with spaces between them.

• Dates are listed in the format MM/DD/YYYY, where MM is a two digit form of the month, DD is a two digit form of the day, and YYYY is a four digit form of the year.

• The name is printed as the last name followed by the optional Sr., Jr., III or IV and then a comma, followed by the first name and then the optional middle initial with a period after it.

• The amount is listed as a dollar sign, followed by the dollars, and followed by a period and two digits for the cents.

You should submit your commented source code, along with the data file you used to test your program, and the corresponding report made by your program for this file.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92045380

Have any Question?


Related Questions in Programming Language

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As