Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. [FirstLoad]
  2. 'I need to define these somewhere untouched
  3. nam1$=""
  4. nam2$=""
  5. nam3$=""
  6.  
  7. Bal = 0 : Bal1 = 0 : Bal2 = 0 : Bal3 = 0
  8. Dep = 0 : Dep1 = 0 : Dep2 = 0 : Dep3 = 0
  9. With = 0 : With1 = 0 : With2 = 0 : With3 =0
  10.  
  11.  
  12. GOSUB [ACC]
  13.  
  14. [Menu]
  15. cls
  16. Print "Welcome, ";Name$
  17. Print ""
  18. Print "Your Current Balance is ";Bal;"$."
  19. if Dep > 0 Then
  20. Print "Your last deposit was ";Dep;"$."
  21. END IF
  22. if With > 0 Then
  23. Print "Your last withdrawal was ";With;"$."
  24. End IF
  25.  
  26.  
  27. Print "================"
  28. Print "A. Deposit"
  29. Print "B. Withdrawal"
  30. Print "C. Show Balance"
  31. Print "L. Log Off"
  32. Print "Q. Quit"
  33. Print ""
  34. Input "Make Selection: ";Choice$
  35.  
  36.  
  37. Select Case Upper$(Choice$)
  38. Case "A"
  39. GOSUB [Deposit]
  40. Case "B"
  41. GOSUB [Withdrawal]
  42. Case "C"
  43. GOSUB [ShowBalance]
  44. Case "L"
  45. GOSUB [ACC]
  46. Case "Q"
  47. GOSUB [Quit]
  48. Case Else
  49. GOSUB [Error]
  50. End Select
  51.  
  52. [Deposit]
  53. cls
  54. Print "Your current Balance is ";Bal;"$."
  55. Input "Amount to Deposit: ";Dep
  56. If Dep > 0 Then
  57. Bal = Bal + Dep
  58. Else
  59. Print "Invalid Amount"
  60. End IF
  61. GOSUB [ShowBalance]
  62.  
  63. [Withdrawal]
  64. cls
  65. Print "Your current Balance is ";Bal;"$."
  66. Input "Amout to Withdraw: ";With
  67. If Bal = 0 Then
  68. Print "Error: No available balance to withdrawal from" : Print "" : Print "Press any key" : dummy$ = input$(1) : cls : GOSUB [Menu]
  69. Else
  70. If With > 1000 Then
  71. Print "Error: Max withdrawal amount is 1000$. Please select a lower amount." : Print "" : Print "Press any key" : dummy$ = input$(1) : cls : GOSUB [Menu]
  72. Else
  73. If With > Bal Then
  74. Print "Insufficient Funds"
  75. Else
  76. If With > 0 Then
  77. GOSUB [Conf]
  78. Else
  79. Print "Invalid Amount"
  80. End If
  81. End IF
  82. End IF
  83. End IF
  84. GOSUB [Menu]
  85.  
  86.  
  87. [Conf]
  88. Input "Confirm you are withdrawing ";With;"$. [Y/N]: ";YN$
  89. if upper$(YN$) = "Y" Then
  90. Bal = Bal - With : GOSUB [ShowBalance]
  91. Else
  92. With = 0 : GOSUB [Menu]
  93. End IF
  94.  
  95.  
  96. [ShowBalance]
  97. Print "Your current balance is ";Bal;"$. Press any key to return to the main menu."
  98. dummy$ = input$(1)
  99. GOSUB [Menu]
  100.  
  101.  
  102. [Error]
  103. Print ""
  104. Print "Invalid Option. Press any key to continue..."
  105. dummy$ = input$(1)
  106. cls
  107. GOSUB [Menu]
  108. Return
  109.  
  110.  
  111. [ACC]
  112.  
  113. cls
  114. Print "Login Screen"
  115. Print ""
  116. Input "Enter Username: ";Name$
  117.  
  118. if nam1$ = "" then
  119. nam1$ = Name$ : Bal1 = Bal : Dep1 = Dep : With1 = With : Bal = 0 : Dep = 0 : With = 0
  120. Else
  121. if nam2$ = "" then
  122. nam2$ = Name$ : Bal2 = Bal : Dep2 = Dep : With2 = With : Bal = 0 : Dep = 0 : With = 0
  123. Else
  124. if nam3$ = "" then
  125. nam3$ = Name$ : Bal3 = Bal : Dep3 = Dep : With3 =With : Bal = 0 : Dep = 0 : With = 0
  126. end if
  127. end if
  128. end if
  129.  
  130. if Name$ = nam1$ then
  131. Bal = Bal1 : Dep = Dep1 : With = With1
  132. Else
  133. if Name$ = nam2$ then
  134. Bal = Bal2 : Dep = Dep2 : With = With2
  135. Else
  136. if Name$ = nam3$ then
  137. Bal = Bal3 : Dep = Dep3 : With = With3
  138. end if
  139. end if
  140. end if
  141.  
  142. GOSUB [Menu]
  143.  
  144. [Quit]
  145. Print "Thanks for using the Banking App"
  146. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement