Bank cards are issued to clients of ABC Bank to enter into transactions on their accounts. A new type of card that they issue has a card number which consists of sixteen digits that are unique to each card issued. The card number is compiled in such a way that certain basic information is encoded

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
Topic Video
Question

Bank cards are issued to clients of ABC Bank to

enter into transactions on their accounts. A new type

of card that they issue has a card number which

consists of sixteen digits that are unique to each

card issued. The card number is compiled in such a

way that certain basic information is encoded

therein by grouping certain digits.

The composition of a card number is as follows:

Card number composition

0 3 1 9 2 1 1 1 1 0 0 8 2 3 6 8

T E A

Where:

T – Type

E – Expiry date

A – Account number

The first four digits (T) represent the card type and

issue year in the format

TTYY

where T is the type (see Table 3.1) and Y is the year,

so in the example is 0319 = Diner's club, issued in

2019.

The following four digits (E) indicate the card's

expiry date in the format

YYMM

Where Y is the year and M is the Month of the year,

so in the example 2111 = 2021, 11th month.

The last eight digits (A) indicate the card's account

number. The series representing the account

number starts with 1 or 0:

0XXXXXXX – Debit account

1XXXXXXX – Credit account

so, in the example 10082368 = Credit account.

Now write a Python program that can read a list of

card numbers from a text file and analyse the

card numbers to extract the encoded data as shown

above for each number. The decoded data must be

written to a text file.

See Figures 3.1 and 3.2 for example output.

Questions 3.1-3.4 must be completed, in order, in

one Python file to create a complete, working

program.

Question 3.1 [10]

Write a function, ReadFile(), that reads the contents

of a text file and stores it in a list. The text file,

Data.txt, is provided and its content is presented in

Table 3.2.

The Data.txt file is saved under “K:\Data.txt”. Make

a backup of the file before the file is accessed by the

program.

Each line in the text file consists of one card

number.

The function receives one parameter: A string list for

where each individual entry from the text file must

be stored. The list is passed by reference to the

function.

The function returns the number of lines that were

read from the text file to the calling statement. If the

file cannot be read, an error message should be

displayed, and the program should close without

any further execution.

NB! – If the function in Question 3.1 does not

function correctly, a list may be explicitly created in

the main program as if the function has read the

contents from the file. This list is to be used in the

following questions

 

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE 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