#

#!/usr/bin/env python3

#OPS435 Assignment 2 – Winter 2018 banking_srho1.py
#Author: Seungbin Rho
#The source code in this file (banking_srho1.py) is original work written by Seungbin Rho and has not been copied from any other source including any person, textbook, or online resource.
#I have not shared this work with anyone or anything except for submission for grading.
#I understand that the Academic Honesty Policy is not a joke and violators will be punished.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

import sys
import csv

def Main_Menu():
while True:
print(‘\nBanking – Main Menu’)
print(‘===================’)
print(‘1) Load Account Data’)
print(‘2) Write Account Data’)
print(‘3) Account Transactions’)
print(‘4) Reporting’)
print(‘q) Quit’)
try:
selection = str(input(“\nSelect to the menu: “))
if selection == “1”:
load_account_data()
elif selection == “2”:
write_account_data()
elif selection == “3”:
account_transfer_submenu()
elif selection == “4”:
reporting_submenu()
elif selection == “q”:
print(‘\nQuit the Menu\n’)
sys.exit()
else:
print(“\nError, Try to type again!!”)
except ValueError:
print(“\nError, Please try it again”)

def account_transfer_submenu():
while True:
print(‘\nAccount Transactions – Sub Menu’)
print(‘================================’)
print(‘1) Deposit to Account’)
print(‘2) Withdraw From Account’)
print(‘3) Transfer Between Accounts’)
print(‘q) Return to Main Menu’)
try:
selection = str(input(“\nSelect the Menu: “))
if selection == “1”:
deposit_account()
elif selection == “2”:
withdrawn_from_account()
elif selection == “3”:
transfer_account()
elif selection == “q”:
Main_Menu()
else:
print(“\nError, Try to type again!!”)
except ValueError:
print(“\nError, Try to type again!!”)

def reporting_submenu():
while True:
print(‘\nReporting – Sub Menu’)
print(‘====================================’)
print(‘1) List All accounts (Account Numbers, Account Names)’)
print(‘2) List Individual account Details’)
print(‘3) Report total bank holdings’)
print(‘q) Return to Main Menu’)
try:
selection = str(input(“\nSelect The Menu: “))
if selection == “1”:
number()
elif selection == “2”:
individual_account_detail()
elif selection == “3”:
report_total_bank()
elif selection == “q”:
Main_Menu()
else:
print(“\nError, Try to type again!!”)
except ValueError:
print(“\nError, Try to type again!!”)

def deposit_account():
f = open(“sampledata.csv”, ‘r’)
csvread = csv.reader(f)
next(csvread)
next(csvread)
next(csvread)
money = int(input(“Type money how much to deposit: “))
for row in csvread:
balance = float(row3)
balance += money
print(row1 + ” Deposited ” + str(money) + “. “+ “Now Current balance is “, str(balance))

def withdrawn_from_account():
f = open(“sampledata.csv”, ‘r’)
csvread = csv.reader(f)
next(csvread)
next(csvread)
next(csvread)
money = int(input(“Type money how much to withdraw: “))
for row in csvread:
balance = float(row3)
balance -= money
if balance < money:
print(row1 + " has not money!!")
else:
print(row1 + " withdrew " + str(money) + ". " + "Now current balance is " + str(balance))

def transfer_account():
f = open("sampledata.csv", 'r')
csvread – csv,reader(f)
next(csvread)
next(csvread)
next(csvread)
print("Transfer")

def individual_account_detail():
f = open("sampledata.csv", 'r')
csvread = csv.reader(f)
next(csvread)
next(csvread)
next(csvread)
for row in csvread:
print("Account Number is " + str(row0) + ". " + "Account name is " + str(row1) + ". " + "Account address is " + str(row2) + ". " + "Account balance is " + str(row3) + ". ")

def report_total_bank():
f = open("sampledata.csv", 'r')
csvread = csv.reader(f)
next(csvread)
next(csvread)
next(csvread)
total_balance = 0
for row in csvread:
total_balance += float(row3)
print("Report: The total balance is " + str(total_balance))

def load_account_data():
f = open("sampledata.csv", 'r')
csvread = csv.reader(f)
next(csvread)
next(csvread)
next(csvread)
for row in csvread:
print(row)

def write_account_data():
write_list = '# Ignore Lines','# File Format','# Account Number', 'AccountOwnerName', 'AccountAddress', 'AccountBalance', '123459','Henry','123 Sesame Street', '12.33', '491231','Harry','245 Sesame Street', '6.01'
f = open('sampledata.csv' , 'w')
with f:
csvwrite = csv.writer(f)
csvwrite.writerows(write_list)

def number():
f = open('sampledata.csv', 'r')
csvread = csv.reader(f)
next(csvread)
next(csvread)
next(csvread)
for row in csvread:
print("Account Number: " + row0 + " " + "Account Name: " + row1 + "")

Main_Menu()

x

Hi!
I'm Owen!

Would you like to get a custom essay? How about receiving a customized one?

Check it out