Академический Документы
Профессиональный Документы
Культура Документы
def create_table(self):
CLASS XII COMPUTER SCIENCE INVESTIGATORY PROJECT (2019-20)
self.conn.execute('''CREATE TABLE ACCOUNT(
ACCOUNT_ID INTEGER,
ACCOUNT_TYPE TEXT,
BALANCE REAL,
WITHDRAWALS INTEGER,
LAST_WITHDRAWAL_TIME TEXT,
FOREIGNKEY(ACCOUNT_ID)REFERENCES
CUSTOMER(CUSTOMER_ID));''')
print ("Account Table created successfully");
def insert_account(self, account_id, account_type, balance):
self.conn.execute("INSERT INTO ACCOUNT (ACCOUNT_ID,
ACCOUNT_TYPE, BALANCE, WITHDRAWALS,
LAST_WITHDRAWAL_TIME) VALUES (:1, :2, :3, 0, NULL)",
(account_id, account_type, balance));
self.conn.commit()
def select_all(self):
cursor = self.conn.execute("SELECT * from ACCOUNT")
for row in cursor:
print ("ACCOUNT_ID = ", row[0])
print ("ACCOUNT_TYPE = ", row[1])
print ("BALANCE = ", row[2])
print ("WITHDRAWALS = ", row[3])
print ("LAST_WITHDRAWAL_TIME = ", row[4], "\n")
def print_statement(self, account_id):
cursor = self.conn.execute("SELECT * from ACCOUNT where ACCOUNT_ID =
:1", (str(account_id),))
else:
print ("Invalid choice")
else:
print ("Invalid Admin ID or password")
def main_menu(database):
while True:
print ("1. Sign Up(New Customer) \n2. Sign In(Existing Customer) \n3. Admin
CLASS XII COMPUTER SCIENCE INVESTIGATORY PROJECT (2019-20)
Sign In \n4. Quit\n")
choice = int(input("Input choice: "))
if choice == 4:
break
if choice == 1:
customer = Customer(database)
customer.signup(database)
customer.close()
elif choice == 2:
customer = Customer(database)
customer.signin(database)
customer.close
elif choice == 3:
customer = Customer(database)
customer.admin_sign_in()
customer.close()
else:
print ("Invalid choice")
database = 'test.db'
try:
customer = Customer(database)
customer.create_table()
customer.close()
account = Account(database)
account.create_table()
account.select_all()
2. Money Deposit