Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE USE JUST BASIC COMPILER ONLY : NO JAVA, NO C++ CODE!! JUST BASIC COMPILER

ID: 3697366 • Letter: P

Question

PLEASE USE JUST BASIC COMPILER ONLY : NO JAVA, NO C++ CODE!! JUST BASIC COMPILER PLEASE

-----------------------------------------------------------------------------------------------------

Use Module6: Hw1 homework to do this homework. You are going to build new features to this simple banking program. All the additional features that I am asking are in BOLD

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 D to deposit Amount

Type W to withdraw Amount

Type E to exit.

·        If the user types P.

·        Populate all the three arrays.

·        And display the menu again.

·        If the user types D then:

·        Ask the user for the account number.

·        Search the accountnumbers() array for that account number and find its position.

·        Ask the user for the amount to be deposited.

·        Add the deposit amount to the balance for that account.

·        If the user types W then:

·        Ask the user for the account number.

·        Search the accountnumbers() array for that account number and find its position.

·        Ask the user for the amount to be withdrawn.

·        Subtract withdrawal amount from the balance for that account.

·        If the user types S then:

·        Ask the user for the account number.

·        Search the array for that account number and find its position.

·        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.

Use Module6: Hw1 homework:

_______________________________________

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

Explanation / Answer

# i n c l u d e <s t d i o .h>

# i n c l u d e < c o n i o . h >

/ / S t r u c t u r e d e c l a r a t i o n   

s t r u c t a c c _ t y p e

{

c h a r b a n k _ n a m e [ 2 0 ] ;

c h a r b a n k _ b r a n c h [ 2 0 ] ;

c h a r a c c _ h o l d e r _n a m e [ 3 0 ] ;

i n t a c c_n u m b e r ; c h a r a c c _ h o l d e r _a d d r e s s [ 1 0 0 ] ;

f l o a t a v a i l a b l e _ b a l a n c e ;

};

i n t n u m _ a c c ;

v o i d C r e a t e_ n e w _ a c c o u n t ( ) ;

v o i d C a s h _ D e p o s i t ( ) ;

v o i d C a s h _ w i t h d r a w l ( ) ;

vo i d A c c o u n t _ i n f o r m a t i o n ( ) ;

vo i d L o g _ o u t ( ) ;

vo i d d i s p l a y _ o p t i o n s ( ) ;

/ * m a i n p r o g r a m * /

m a i n ( )

{

c h a r o p t i o n ;

n u m _ a c c = 0 ;

w h i l e ( 1 )

{

p r i n t f ( " nW e l c o m e t o B a n k A p p l i c a t i o n n " ) ;

d i s p l a y _ o p t i o n s ( ) ;

p r i n t f ( " P l e a s e e n t e r a n y o p t i o n s ( 1 / 2 / 3 / 4 / 5 / 6 ) " ) ;

p r i n t f ( " t o c o n t i n u e : " ) ;

o p t i o n = g e t c h ( ) ;

p r i n t f ( " % c n " , o p t i o n ) ;

s w i t c h ( o p t i o n )

{

c a s e ' 1 ' : C r e a t e _ n e w _ a c c o u n t ( ) ;

b r e a k ;

ca s e ' 2 ' : C a s h _ D e p o s i t ( ) ;

b r e a k ;

c a s e ' 3 ' : C a s h _ w i t h d r a w l ( ) ;

b r e a k ;

c a s e ' 4 ' : A c c o u n t _ i n f o r m a t i o n ( ) ;

b r e a k ;

c a s e ' 5 ' : r e t u r n 0 ;

c a s e ' 6 ' : s y s t e m ( " c l s " ) ;

b r e a k ;

d e f a u l t : s y s t e m ( " c l s " ) ;

p r i n t f ( " P l e a s e e n t e r o n e o f t h e o p t i o n s " ) ;

p r i n t f ( " ( 1 / 2 / 3 / 4 / 5 / 6 ) t o c o n t i n u e n " ) ;

b r e a k ;

}

}

r e t u r n 0 ;

}

/ *

F u n c t i o n t o d i s p l a y a v a i l a b l e o p t i o n s i n t h i s a p p l i c a t i o n

* /

vo i d d i s p l a y _ o p t i o n s ( )

{

p r i n t f ( " n 1 . C r e a t e n e w a c c o u n t n " ) ;

p r i n t f ( " 2 . C a s h D e p o s i t n " ) ;

p r i n t f ( " 3 . C a s h w i t h d r a w l n " ) ;

p r i n t f ( " 4 . A c c o u n t i n f o r m a t i o n n " ) ;

p r i n t f ( " 5 . L o g o u t n " ) ;

p r i n t f ( " 6 . C l e a r t h e s c r e e a n d d i s p l a y a v a i l a b l e " ) ;

p r i n t f ( " o p t i o n s n n " ) ;

}

/ * F u n c t i o n t o c r e a t e n e w

a c c o u n t * /

vo i d C r e a t e _ n e w _ a c c o u n t ( )

{

c h a r b a n k _ n a m e [ 2 0 ] ;

c h a r b a n k _ b r a n c h [ 2 0 ] ;

c h a r a c c _ h o l d e r _ n a m e [ 3 0 ] ;

i n t a c c _ n u m b e r ;

c h a r a c c _ h o l d e r _ a d d r e s s [ 1 0 0 ] ;

f l o a t a v a i l a b l e _ b a l a n c e = 0 ;

f f l u s h ( s t d i n ) ;

p r i n t f ( " n E n t e r t h e b a n k n a m e : " ) ;

s c a n f ( " % s " , & b a n k _ n a m e ) ;

p r i n t f ( " n E n t e r t h e b a n k b r a n c h : " ) ;

s c a n f ( " % s " , & b a n k _ b r a n c h ) ;

p r i n t f ( " n E n t e r t h e a c c o u n t n u m b e r ( 1 t o 1 0 ) : " ) ;

s c a n f ( " % d " , & a c c _ n u m b e r ) ;

p r i n t f ( " n E n t e r t h e a c c o u n t h o l d e r a d d r e s s : " ) ;

s c a n f ( " % s " , & a c c _ h o l d e r _ a d d r e s s ) ;

s t r c p y ( a c c o u n t [ a c c _ n u m b e r - 1 ] . b a n k _ n a m e , b a n k _ n a m e ) ;

s t r c p y ( a c c o u n t [ a c c _ n u m b e r - 1 ] . b a n k _ b r a n c h , b a n k _ b r a n c h ) ;

s t r c p y ( a c c o u n t [ a c c _ n u m b e r - 1 ] . a c c _ h o l d e r _ n a m e , a c c _ h o l d e r _ n a m e ) ;

a c c o u n t [ a c c _ n u m b e r - 1 ] . a c c _ n u m b e r = a c c _ n u m b e r ;

s t r c p y ( a c c o u n t [ a c c _ n u m b e r - 1 ] . a c c _ h o l d e r _ a d d r e s s ,

a c c _ h o l d e r _ a d d r e s s ) ;

a c c o u n t [ a c c _ n u m b e r - 1 ] . a v a i l a b l e _ b a l a n c e = a v a i l a b l e _ b a l a n c e ;

p r i n t f ( " n A c c o u n t h a s b e e n c r e a t e d s u c c e s s f u l l y n n " ) ;

p r i n t f ( " B a n k n a m e : % s n " , a c c o u n t [ a c c _ n u m b e r - 1 ] . b a n k _ n a m e ) ;

p r i n t f ( " B a n k b r a n c h : % s n " , a c c o u n t [ a c c _ n u m b e r - 1 ] . b a n k _ b r a n c h ) ;

p r i n t f ( " A c c o u n t h o l d e r n a m e : % s n " , a c c o u n t [ a c c _ n u m b e r - 1 ] . a c c _ h o l d e r _ n a m e ) ;

p r i n t f ( " A c c o u n t n u m b e r : % d n " , a c c o u n t [ a c c _ n u m b e r - 1 ] . a c c _ n u m b e r ) ;

p r i n t f ( " A c c o u n t h o l d e r a d d r e s s : % s n " , a c c o u n t [ a c c _ n u m b e r - 1 ] . a c c _ h o l d e r _ a d d r e s s ) ;

p r i n t f ( " A v a i l a b l e b a l a n c e : % f n " , a c c o u n t [ a c c _ n u m b e r - 1 ] . a v a i l a b l e _ b a l a n c e ) ; / / n u m _ a c c + + ;

}

/ /

D i s p l a y i n g a c c o u n t i n f o r m a t i o n s

vo i d A c c o u n t _ i n f o r m a t i o n ( )

{

r e g i s t e r i n t n u m _ a c c = 0 ;

/ /

i f (!s t r c m p ( c u s t o m e r , a c c o u n t [ c o u n t ] . n a m e ) )

w h i l e ( s t r l e n ( a c c o u n t [ n u m _ a c c ] . b a n k _ n a m e ) > 0 )

{

p r i n t f ( " n B a n k n a m e : % s n " , a c c o u n t [ n u m _ a c c ] . b a n k _ n a m e ) ;

p r i n t f ( " B a n k b r a n c h : % s n " , a c c o u n t [ n u m _ a c c ] . b a n k _ b r a n c h ) ;

p r i n t f ( " A c c o u n t h o l d e r n a m e : % s n " , a c c o u n t [ n u m _ a c c ] . a c c _ h o l d e r _ n a m e ) ;

p r i n t f ( " A c c o u n t n u m b e r : % d n " , a c c o u n t [ n u m _ a c c ] . a c c _ n u m b e r ) ;

p r i n t f ( " A c c o u n t h o l d e r a d d r e s s : % s n " , a c c o u n t [ n u m _ a c c ] . a c c _ h o l d e r _ a d d r e s s ) ;

p r i n t f ( " A v a i l a b l e b a l a n c e : % f n n " , a c c o u n t [ n u m _ a c c ] . a v a i l a b l e _ b a l a n c e ) ;

n u m _ a c c + + ;

}

}

/ /

F u n c t i o n t o d e p o s i t a m o u n t i n a n a c c o u n t

vo i d C a s h _ D e p o s i t ( )

{

a u t o i n t a c c _ n o ;

f l o a t a d d _ m o n e y ;

p r i n t f ( " E n t e r c c o u n t n u m b e r y o u w a n t t o d e p o s i t m o n e y : " ) ;

s c a n f ( " % d " , & a c c _ n o ) ;

p r i n t f ( " n T h e c u r r e n t b a l a n c e f o r a c c o u n t % d i s % f n " , a c c _ n o , a c c o u n t [ a c c _ n o - 1 ] . a v a i l a b l e _ b a l a n c e ) ;

p r i n t f ( " n E n t e r m o n e y y o u w a n t t o d e p o s i t : " ) ;

s c a n f ( " % f " , & a d d _ m o n e y ) ;

w h i l e ( a c c _ n o = a c c o u n t [ a c c _ n o - 1 ] . a c c _ n u m b e r )

p r i n t f ( " n E n t e r t h e a c c o u nt h o l d e r n a m e : " ) ;

s c a n f ( " % s " , & a c c _ h o l d e r _ n a m e ) ;

{

account[acc_no-1].available_balance= account[acc_no-1].available_balance+add_money;

p r i n t f ( " n T h e N e w b a l a n c e f o r a c c o u n t % d i s % f ", a c c _ n o , a c c o u n t [a c c _ n o - 1 ] . a v a i l a b l e _ b a l a n c e ) ;

b r e a k ;

}

a c c _ n o + + ;

}

//

F u n c t i o n t o w i t h d r a w a m o u n t f r o m a n a c c o u n t

v o i d C a s h _ w i t h d r a w l ( )   

{ a u t o i n t a c c _ n o ;

f l o a t w i t h d r a w _ m o n e y ;

p r i n t f ( " E n t e r a c c o u n t n u m b e r y o u w a n t t o w i t h d r a w m o n e y : " );

s c a n f ( " % d " , & a c c _ n o ) ;

p r i n t f ( " n T h e c u r r e n t b a l a n c e f o r a c c o u n t %d is %f ", a c c _ n o , a c c o u n [ a c c _ n o - 1 ] . a v a i l a b l e_ b a l a n c e ) ;

p r i n t f ( " E n t e r mo n e y y o u w a n t t o w i t h d r a w f r o m a c c o u n t ");

s c a n f ( " % f " , & w i t h d r a w _ m o n e y ) ;

w h i l e ( a c c _ n o = a c c o u n t [ a c c _ n o - 1 ] .a c c _n u m b e r )

{

a c c o u n t [ a c c _ n o - 1 ] . a v a i l a b l e_b a l a n c e = a c c o u n t [ a c c _ n o - 1 ] . a v a i l a b l e _ b a l a n c e - w i t h d r a w _ m o n e y ;

pr i n t f ( " n T h e N e w b a l a n ce f o r a c c o u n t % d i s % f n " , a c c_ n o , a c c o u n t [ a c c_ n o - 1 ] . a v a i l a b l e _ b a l a n c e );

b r e a k ;

}

a c c _ n o + + ;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote