PLEASE USE JUST BASIC COMPILER ONLY : NO JAVA, NO C++ CODE!! JUST BASIC COMPILER
ID: 3697208 • Letter: P
Question
PLEASE USE JUST BASIC COMPILER ONLY : NO JAVA, NO C++ CODE!! JUST BASIC COMPILER PLEASE
-----------------------------------------------------------------------------------------------------
Banking Application using Arrays and Functions.
After you write and submit this program, please keep a copy of it with yourself. Because you will be using it for the next homework.
Create three arrays called Names$(10) and accountnumbers(10) and balance(10)
Notice that the Names$(10) array is a string array while accountnumbers(10) and balance(10) are numeric arrays.
Write a program to display the menu with the following options and ask for the user input.
Type P to populate accounts
Type S to search for account.
Type E to exit.
· If the user types P.
Populate all the three arrays.
And display the menu again.
· If the user types S then:
Ask the user for the account number.
Search the array for that account number and find its position in the accountnumbers array.
Display the Name$, and balance at the position found during the above search.
If the user types E. then:
Terminate the program.
If the user types any other option:
Display the message “Invalid Choice. Try again” and go back and display the menu.
PS: You program must keep displaying the menu until the user types the option E, to exit the program.
Explanation / Answer
Is this you are looking for??
Dim Names$(10)
Dim accountnumbers(10)
Dim balance(10)
do
print "Please Enter P To Populate Accounts."
print "Please Enter S To Search For Account."
print "Please Enter E To Exit."
input opt$
select case
case opt$ = "P" or opt$ = "p"
res = populatearray(10)
case opt$ = "S" or opt$ = "s"
print "Please Enter The Account Number To Search For."
input acctsrchfor
res = findacct(acctsrchfor)
if (pos > 10) then
print "Account Not Found."
else
print "This Is The Account For ";Names$(res)
print "The Balance In This Account Is ";balance(res)
end if
case opt$ = " "
print "Invalid Choice. Please Try Again."
case opt$ = "E" or opt$ = "e"' do nothing... this is handled in the LOOP UNTIL line
case else
print "Invalid Choice. Please Try Again."
end select
loop until opt$ = "E" or opt$ = "e"
print "Thank You And Have A Nice Day."
end
function populatearray(size)
for position = 1 to size
print "Please Enter Name."
input Names$(position)
print "Please Enter Account Number."
input accountnumbers(position)
print "Please Enter Balance."
input balance(position)
next
end function
function displayarray(size)
for position = 1 to size
print "#" ; position
print Names$(position)
print accountnumbers(position)
print balance(position)
next
end function
function findacct(accountnumber)
position = 0
for position = 1 to 10
if accountnumbers(position) = accountnumber then findacct = position
next
end function
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.