0% found this document useful (0 votes)
3 views2 pages

Algorithm

Uploaded by

yenulkadesilva
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)
3 views2 pages

Algorithm

Uploaded by

yenulkadesilva
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/ 2

ALGORITHM EXAMPLE

 Start

 Initialize Variables

 Enter a While Loop to Display the Main Menu Until the User Exits the Program

 Display the Main Menu Options:


o I. Add a new customer
o II. View details of a customer
o III. View details of all customers
o IV. Deposit money to a given account
o V. Withdraw money from a given account
o VI. Update customer details
o VII. Exit

 Display Relevant Information According to the User’s Choice

 If User Chooses "1" (Add a New Customer):


o Use a loop to add up to 5 customers.
o Prompt user to enter and validate:
 Bank account number (must be 10 characters)
 NIC (must be 10 characters)
 First name (up to 10 characters)
 Last name (up to 15 characters)
 Birth date (mandatory input)
 Permanent address (up to 15 characters)
 Phone number (must be exactly 10 digits)
o Display appropriate error messages for invalid inputs.
o Save customer details.
o If the number of customers exceeds the limit, display a message indicating the
limit has been exceeded.
 If User Chooses "2" (View Details of a Customer):
o Prompt user to enter bank account number and validate it.
o Retrieve and display customer details.
o Offer option to view details of another account.
 If User Chooses "3" (View Details of All Customers):
o Display all customer details.
o Offer option to update customer details.
o Prompt user to input bank account number and validate it.
o Update customer details as relevant.
o Offer option for the user to save updated customer details or not.
 If User Chooses "4" (Deposit Money to a Given Account):
o Prompt user to input bank account number and validate it.
o Prompt user to enter deposit amount.
o Offer option to save the deposited amount or not.
 If User Chooses "5" (Withdraw Money from a Given Account):
o Prompt user to input bank account number and validate it.
o Prompt user to enter withdraw amount.
o Offer option to save the withdraw amount or not.
 If User Chooses "6" (Update Customer Details):
o Prompt user to input bank account number and validate it.
o Update customer details as relevant.
o Offer option for the user to save updated customer details.
 If User Chooses "7" (Exit):
o Print "You have exited the program" and break out of the loop.
 Handle Invalid Choices:
o If the user inputs a choice other than 1 to 7, display "Invalid Choice. Choose from
1 to 7".
o If the input is an empty string, break out of the loop.
 End

You might also like