0% found this document useful (0 votes)
58 views6 pages

Pseudocode

banking system

Uploaded by

Sushan Kc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views6 pages

Pseudocode

banking system

Uploaded by

Sushan Kc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

FUNCTION create_customer()

id = generate_unique_id()

created_at = current_date()

updated_at = current_date()

INPUT name

WHILE true

INPUT password

IF is_valid_password(password) THEN

BREAK

ELSE

PRINT "Password does not meet criteria. Try again."

END IF

END WHILE

WHILE true

INPUT account_type

IF account_type is "savings" OR "current" THEN

BREAK

ELSE

PRINT "Invalid account type. Choose savings or current."

END IF

END WHILE

WHILE true

INPUT initial_deposit

IF initial_deposit is valid AND meets minimum requirement THEN

BREAK
ELSE

PRINT "Invalid deposit amount. Try again."

END IF

END WHILE

CREATE new customer record

WRITE customer record to file

RECORD initial deposit as transaction

PRINT "Account created successfully"

END FUNCTION

FUNCTION is_valid_password(password)

IF length of password < 8 THEN

RETURN false

END IF

has_upper = false

has_lower = false

has_digit = false

has_special = false

FOR EACH character in password

IF character is uppercase THEN

has_upper = true

ELSE IF character is lowercase THEN

has_lower = true

ELSE IF character is digit THEN

has_digit = true

ELSE IF character is special THEN


has_special = true

END IF

END FOR

RETURN (has_upper AND has_lower AND has_digit AND has_special)

END FUNCTION

FUNCTION deposit(customer_id, amount)

IF amount is not positive number THEN

PRINT "Invalid amount"

RETURN

END IF

IF NOT customer_exists(customer_id) THEN

PRINT "Customer doesn't exist"

RETURN

END IF

write_deposit_to_file(customer_id, amount)

PRINT "Deposit successful"

END FUNCTION

FUNCTION withdraw(customer_id, amount)

IF amount is not positive number THEN

PRINT "Invalid amount"

RETURN

END IF

IF NOT customer_exists(customer_id) THEN


PRINT "Customer doesn't exist"

RETURN

END IF

current_balance = calculate_current_balance_of_customer(customer_id)

customer = get_customer_by_id(customer_id)

min_balance = get_minimum_balance(customer.account_type)

IF (current_balance - amount) < min_balance THEN

PRINT "Insufficient balance for withdrawal"

RETURN

END IF

write_withdraw_to_file(customer_id, amount)

PRINT "Withdrawal successful"

END FUNCTION

FUNCTION generate_customer_report(customer_id)

INPUT start_date

INPUT end_date

IF NOT validate_date(start_date) OR NOT validate_date(end_date) THEN

PRINT "Invalid date format"

RETURN

END IF

transactions = get_transactions_by_date_range(customer_id, start_date, end_date)

IF transactions is empty THEN


PRINT "No transactions found"

RETURN

END IF

PRINT report header

FOR EACH transaction in transactions

PRINT formatted transaction details

END FOR

CALCULATE and PRINT summary (total deposits, withdrawals, net change, final balance)

END FUNCTION

FUNCTION change_customer_password(customer)

INPUT current_password

IF current_password != customer.password THEN

PRINT "Incorrect current password"

RETURN

END IF

WHILE true

INPUT new_password

IF is_valid_password(new_password) THEN

INPUT confirm_password

IF new_password == confirm_password THEN

BREAK

ELSE

PRINT "Passwords do not match"


END IF

ELSE

PRINT "Password does not meet criteria"

END IF

END WHILE

update_customer_password(customer.id, new_password)

PRINT "Password changed successfully"

END FUNCTION

FUNCTION login_as_admin()

WHILE true

INPUT username

IF username == "\q" THEN

RETURN false

END IF

IF NOT does_username_exist(username) THEN

PRINT "User does not exist"

CONTINUE

END IF

INPUT password

IF validate_password(username, password) THEN

RETURN true

ELSE

PRINT "Invalid username or password"

END IF

END WHILE

END FUNCTION

You might also like