Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.36 KB | None | 0 0
  1. Module Module1
  2.  
  3. ' Variable Declaration
  4. Dim Money_In, Money_Out, PIN, Num_Of_Attempts, Time_Counter As Integer
  5. Dim User_Input, Space, Central_Alignment, Central_Transaction_Log_Alignment, Central_Title_Alignment, Right_Alignment, Left_Alignment, Another_Service, Central_Text_Alignment As String
  6. Dim PIN_Attempt As String = String.Empty
  7. Dim Info As ConsoleKeyInfo
  8. Dim File_Num, Count, Last_Record As Integer
  9. Dim File_Name As String
  10. Dim Account_Details(200, 200), Titles(4) As String
  11. Dim Balance As Decimal
  12. Sub Main()
  13. ' Login System Variables
  14. PIN = "1234"
  15. Num_Of_Attempts = 3
  16.  
  17. ' Console Formatting
  18. Console.WindowHeight = Console.LargestWindowHeight - 10
  19. Console.WindowWidth = Console.LargestWindowWidth - 15
  20.  
  21. Console.ForegroundColor = ConsoleColor.DarkYellow
  22. Console.BackgroundColor = ConsoleColor.DarkBlue
  23. Console.Clear()
  24.  
  25. Space = " "
  26. Central_Alignment = " "
  27. Central_Transaction_Log_Alignment = " "
  28. Central_Title_Alignment = " "
  29. Central_Text_Alignment = " "
  30. Right_Alignment = " "
  31. Left_Alignment = " "
  32.  
  33. ' Titles Array
  34. Titles(0) = "DATE"
  35. Titles(1) = "TRANSACTION"
  36. Titles(2) = "MONEY IN"
  37. Titles(3) = "MONEY OUT"
  38. Titles(4) = "BALANCE"
  39.  
  40. Login:
  41. ' Login Screen
  42. Console.Clear()
  43. Console.WriteLine()
  44. Console.WriteLine(Central_Title_Alignment & " /\\\\\\\\\\\ /\\\ /\\\\ /\\\\\\\\\\\\\ ")
  45. Console.WriteLine(Central_Title_Alignment & " \/////\\\/// \/\\\ \///\\ \/\\\/////////\\\ /\\\ ")
  46. Console.WriteLine(Central_Title_Alignment & " \/\\\ \/\\\ /\\/ \/\\\ \/\\\ \/\\\ ")
  47. Console.WriteLine(Central_Title_Alignment & " \/\\\ /\\\\\ /\\\\\\\\\\ \/\\\ \// /\\\\\\\\\\ \/\\\\\\\\\\\\\\ /\\\\\\\\\ /\\/\\\\\\ \/\\\\\\\\ ")
  48. Console.WriteLine(Central_Title_Alignment & " \/\\\ /\\\///\\\ \/\\\////// \/\\\\\\\\\\ \/\\\////// \/\\\/////////\\\ \////////\\\ \/\\\////\\\ \/\\\////\\\ ")
  49. Console.WriteLine(Central_Title_Alignment & " \/\\\ /\\\ \//\\\ \/\\\\\\\\\\ \/\\\/////\\\ \/\\\\\\\\\\ \/\\\ \/\\\ /\\\\\\\\\\ \/\\\ \//\\\ \/\\\\\\\\/ ")
  50. Console.WriteLine(Central_Title_Alignment & " /\\\ \/\\\ \//\\\ /\\\ \////////\\\ \/\\\ \/\\\ \////////\\\ \/\\\ \/\\\ /\\\/////\\\ \/\\\ \/\\\ \/\\\///\\\ ")
  51. Console.WriteLine(Central_Title_Alignment & " \//\\\\\\\\\ \///\\\\\/ /\\\\\\\\\\ \/\\\ \/\\\ /\\\\\\\\\\ \/\\\\\\\\\\\\\/ \//\\\\\\\\/\\ \/\\\ \/\\\ \/\\\ \///\\\ ")
  52. Console.WriteLine(Central_Title_Alignment & " \///////// \///// \////////// \/// \/// \////////// \///////////// \////////\// \/// \/// \/// \/// ")
  53. Console.WriteLine()
  54. Console.WriteLine()
  55.  
  56. ' Date
  57. Console.WriteLine(Right_Alignment & "Date: " & Today)
  58. Console.Write(Right_Alignment & "================")
  59.  
  60. ' Login System
  61. Console.Write(Central_Alignment & "Please enter your PIN number: ")
  62. PIN_Attempt = Console.ReadLine()
  63.  
  64. ' IF Statement Representing the PIN System
  65. If PIN_Attempt = PIN Then
  66. Console.Beep()
  67. GoTo LoadFile
  68. End If
  69.  
  70. ' Do...Until Loop Checking to See IF the PIN is Correct or Not, and what to do Next
  71. Do Until PIN_Attempt = PIN
  72. If PIN_Attempt <> PIN Then
  73. ' Sends a Beep to The Console
  74. Console.Beep()
  75. Console.Beep()
  76. Num_Of_Attempts -= 1
  77. MsgBox("Invalid Pin, please try again. Number of attempts remaining: " & Num_Of_Attempts)
  78. If Num_Of_Attempts = 0 Then
  79. MsgBox("Too Many Attempts!! Program Will Close!!")
  80. End
  81. End If
  82. GoTo Login
  83. End If
  84. Loop
  85.  
  86. Console.ReadLine()
  87. Menu:
  88. ' Main Menu
  89. Console.Clear()
  90. Console.WriteLine()
  91. Console.WriteLine(Central_Alignment & "################")
  92. Console.WriteLine(Central_Alignment & " Main Menu ")
  93. Console.WriteLine(Central_Alignment & "################")
  94.  
  95. ' Date
  96. Console.WriteLine(Right_Alignment & "Date: " & Today)
  97. Console.Write(Right_Alignment & "================")
  98.  
  99. ' Menu
  100. Console.WriteLine()
  101. Console.WriteLine(Central_Alignment & "1. Account Details")
  102. Console.WriteLine()
  103. Console.WriteLine(Central_Alignment & "2. Withdraw")
  104. Console.WriteLine()
  105. Console.WriteLine(Central_Alignment & "3. Deposit")
  106. Console.WriteLine()
  107. Console.WriteLine(Central_Alignment & "4. Overdraft")
  108. Console.WriteLine()
  109. Console.WriteLine(Central_Alignment & "5. Transaction Log")
  110. Console.WriteLine()
  111. Console.WriteLine(Central_Alignment & "6. Current Balance")
  112. Console.WriteLine()
  113. Console.WriteLine(Central_Alignment & "7. Help")
  114. Console.WriteLine()
  115. Console.WriteLine(Central_Alignment & "8. Exit")
  116. Console.WriteLine()
  117. Console.Write(Central_Alignment & "Please select your choice: ")
  118. Console.CursorVisible = False
  119. User_Input = Console.ReadLine
  120.  
  121. ' Select Case Statement that Displays Menu Items
  122. Select Case User_Input
  123. Case 1
  124. GoTo Account_Details
  125. Case 2
  126. GoTo Withdraw
  127. Case 3
  128. GoTo Deposit
  129. Case 4
  130. GoTo Overdraft
  131. Case 5
  132. GoTo Transaction_Log
  133. Case 6
  134. GoTo Current_Balance
  135. Case 7
  136. GoTo Help
  137. Case 8
  138. GoTo Exit_System
  139. Case Else
  140. Console.Clear()
  141. Console.Beep()
  142. ' Main Menu
  143. Console.Clear()
  144. Console.WriteLine()
  145. Console.WriteLine(Central_Alignment & "################")
  146. Console.WriteLine(Central_Alignment & " Main Menu ")
  147. Console.WriteLine(Central_Alignment & "################")
  148. Console.WriteLine()
  149. Console.WriteLine()
  150. Console.WriteLine(Central_Text_Alignment & "An error has occured, please enter a number between 1 and 8.")
  151. Console.WriteLine()
  152. Console.WriteLine(Central_Text_Alignment & "Press enter to return to the main menu.")
  153. Console.ReadLine()
  154. GoTo Menu
  155. End Select
  156. Console.ReadLine()
  157.  
  158. Account_Details:
  159. ' Account Details Screen
  160. Console.Clear()
  161. Console.WriteLine()
  162. Console.WriteLine(Central_Alignment & "######################")
  163. Console.WriteLine(Central_Alignment & " Account Details ")
  164. Console.WriteLine(Central_Alignment & "######################")
  165.  
  166. ' Date
  167. Console.WriteLine(Right_Alignment & "Date: " & Today)
  168. Console.Write(Right_Alignment & "================")
  169. Console.WriteLine()
  170.  
  171. ' Menu
  172. Console.WriteLine(Central_Alignment & "1. Change PIN")
  173. Console.WriteLine()
  174. Console.WriteLine(Central_Alignment & "2. Overdraft")
  175. Console.WriteLine()
  176. Console.WriteLine(Central_Alignment & "3. Back")
  177. Console.WriteLine()
  178. Console.Write(Central_Alignment & "Please select your choice: ")
  179. User_Input = Console.ReadLine()
  180.  
  181. ' Select Case Statement For Account Details
  182. Select Case User_Input
  183. Case 1
  184. GoTo Change_PIN
  185. Case 2
  186. GoTo Overdraft
  187. Case 3
  188. GoTo Menu
  189. Case Else
  190. Console.Clear()
  191. Console.Beep()
  192. Console.WriteLine()
  193. ' Main Menu
  194. Console.Clear()
  195. Console.WriteLine()
  196. Console.WriteLine(Central_Alignment & "######################")
  197. Console.WriteLine(Central_Alignment & " Account Details ")
  198. Console.WriteLine(Central_Alignment & "#######################")
  199. Console.WriteLine()
  200. Console.WriteLine()
  201. Console.WriteLine(Central_Text_Alignment & "An error has occured, please enter a number between 1 and 3.")
  202. Console.ReadLine()
  203. GoTo Menu
  204. End Select
  205. Console.ReadLine()
  206. Deposit:
  207. ' Deposit Screen
  208. Console.Clear()
  209. Console.WriteLine()
  210. Console.WriteLine(Central_Alignment & "##############")
  211. Console.WriteLine(Central_Alignment & " Deposit ")
  212. Console.WriteLine(Central_Alignment & "##############")
  213.  
  214. ' Date
  215. Console.WriteLine(Right_Alignment & "Date: " & Today)
  216. Console.Write(Right_Alignment & "================")
  217. Console.WriteLine()
  218.  
  219. Console.Write(Central_Text_Alignment & "Please Enter Amount you want to Deposit: £")
  220.  
  221. Money_In = Console.ReadLine 'Saves the amount the user entered as Money_In
  222. Balance = Balance + Money_In 'Adds the money the user wants to deposit to the balance
  223.  
  224. ' Confirmation message
  225. Console.WriteLine()
  226. Console.WriteLine(Central_Text_Alignment & "Thank you for your deposit, you now have a balance of £" & Balance & ".")
  227. Console.WriteLine()
  228.  
  229. ' File Import
  230. File_Name = "account.txt"
  231. File_Num = FreeFile()
  232. If File_Name <> "" Then
  233. Try
  234. Last_Record = Last_Record + 1 ' Increments records in file by 1
  235. Account_Details(Last_Record, 0) = Today ' Date
  236. Account_Details(Last_Record, 1) = "CashPoint" ' Transaction
  237. Account_Details(Last_Record, 2) = Money_In ' Money_In
  238. Account_Details(Last_Record, 3) = " " ' Money_Out
  239. Account_Details(Last_Record, 4) = Balance ' Balance
  240.  
  241. ' Append details to file
  242. FileOpen(File_Num, File_Name, OpenMode.Append)
  243.  
  244. PrintLine(File_Num, Account_Details(Last_Record, 0)) ' Date
  245. PrintLine(File_Num, Account_Details(Last_Record, 1)) ' Transaction
  246. PrintLine(File_Num, Account_Details(Last_Record, 2)) ' Money_In
  247. PrintLine(File_Num, Account_Details(Last_Record, 3)) ' Money_Out
  248. PrintLine(File_Num, Account_Details(Last_Record, 4)) ' Balance
  249. MsgBox("Deposit File Updated", , "File Updated")
  250. ' Update Current Record
  251.  
  252. Catch ex As Exception
  253. MsgBox("Error Opening File")
  254. Finally
  255. FileClose(File_Num)
  256. End Try
  257. End If
  258.  
  259. Console.WriteLine(Central_Text_Alignment & "Press enter to return to the main menu.")
  260. Console.ReadLine()
  261. GoTo Menu
  262. Withdraw:
  263. ' Witdraw Screen
  264. Console.Clear()
  265. Console.WriteLine()
  266. Console.WriteLine(Central_Alignment & "################")
  267. Console.WriteLine(Central_Alignment & " Withdraw ")
  268. Console.WriteLine(Central_Alignment & "################")
  269.  
  270. ' Date
  271. Console.WriteLine(Right_Alignment & "Date: " & Today)
  272. Console.WriteLine(Right_Alignment & "================")
  273.  
  274. Console.Write(Central_Text_Alignment & "Please Enter Amount to Withdraw: £")
  275. Money_Out = Console.ReadLine 'Saves the amount of money the user wants to withdraw as Money_Out
  276.  
  277. '***Checks if input is multiple of 5***
  278. If Money_Out Mod 5 <> 0 Then
  279. MsgBox("Amount Must Be A Multiple Of 5!")
  280. GoTo Withdraw
  281. End If
  282.  
  283. '***Checks if there is enough balance to withdraw from***
  284. If Money_Out > 300 Then 'Checks if the user is trying to withdraw more than £300
  285. MsgBox("Exceeds Daily Amount") 'Displays message box
  286. GoTo Withdraw 'Goes back to begining of withdraw screen
  287. End If
  288.  
  289. If Money_Out > Balance Then 'Is the user trying to take out more money then is in the balance?
  290. MsgBox("Insuficient Funds") 'Displays message box if there isn't enough balance
  291. GoTo Withdraw 'Goes to the Withdraw screen
  292. End If
  293.  
  294. ' Check withdrawal against balance
  295. If Money_Out <= Balance Then
  296. Balance = Balance - Money_Out
  297. Console.WriteLine()
  298. Console.WriteLine(Central_Text_Alignment & "You now have a balance of £" & Balance & ".")
  299. Console.WriteLine()
  300.  
  301. File_Name = "account.txt"
  302. File_Num = FreeFile()
  303. If File_Name <> "" Then
  304. Try
  305. Last_Record = Last_Record + 1 ' Increments records in file by 1
  306. Account_Details(Last_Record, 0) = Today ' Date
  307. Account_Details(Last_Record, 1) = "CashPoint" ' Transaction
  308. Account_Details(Last_Record, 2) = " " ' Money_In
  309. Account_Details(Last_Record, 3) = Money_Out ' Money_Out
  310. Account_Details(Last_Record, 4) = Balance ' Balance
  311.  
  312. ' Append details to file
  313. FileOpen(File_Num, File_Name, OpenMode.Append)
  314.  
  315. PrintLine(File_Num, Account_Details(Last_Record, 0)) ' Date
  316. PrintLine(File_Num, Account_Details(Last_Record, 1)) ' Transaction
  317. PrintLine(File_Num, Account_Details(Last_Record, 2)) ' Money_In
  318. PrintLine(File_Num, Account_Details(Last_Record, 3)) ' Money_Out
  319. PrintLine(File_Num, Account_Details(Last_Record, 4)) ' Balance
  320. MsgBox("Transaction File Updated", , "File Updated")
  321. ' Update Current Record
  322.  
  323. Catch ex As Exception
  324. MsgBox("Error Opening File")
  325. Finally
  326. FileClose(File_Num)
  327. End Try
  328. End If
  329.  
  330. Else
  331. Console.WriteLine("Sorry - Insufficient Funds")
  332. Console.ReadLine()
  333. End If
  334.  
  335. Console.WriteLine(Central_Text_Alignment & "Press enter to return to the main menu.")
  336. Console.ReadLine()
  337. GoTo Menu
  338.  
  339. Transaction_Log:
  340. ' Transaction Log
  341. Console.Clear()
  342. Console.WriteLine()
  343. Console.WriteLine(Central_Alignment & "######################")
  344. Console.WriteLine(Central_Alignment & " Transaction Log ")
  345. Console.WriteLine(Central_Alignment & "######################")
  346.  
  347. ' Date
  348. Console.WriteLine(Right_Alignment & "Date: " & Today)
  349. Console.Write(Right_Alignment & "================")
  350. Console.WriteLine()
  351. Console.WriteLine()
  352. Console.WriteLine(Central_Transaction_Log_Alignment & " " & Titles(0) & " " & Titles(1) & " " & Titles(2) & " " & Titles(3) & " " & Titles(4))
  353. Console.ForegroundColor = ConsoleColor.Gray
  354.  
  355. ' For Loop Displaying Records
  356. For Count = 0 To Last_Record
  357. Console.WriteLine(Central_Transaction_Log_Alignment & Account_Details(Count, 0) & Space & Account_Details(Count, 1) & Space & Account_Details(Count, 2) & " " & Account_Details(Count, 3) & " " & Account_Details(Count, 4))
  358. Next Count
  359.  
  360. Console.ForegroundColor = ConsoleColor.DarkYellow
  361. Console.WriteLine()
  362. Console.WriteLine(Right_Alignment & "Total Balance £" & Balance)
  363. Console.ReadLine()
  364. GoTo Menu
  365.  
  366. Current_Balance:
  367. ' Current Balance
  368. Console.Clear()
  369. Console.WriteLine()
  370. Console.WriteLine(Central_Alignment & "################")
  371. Console.WriteLine(Central_Alignment & " Balance ")
  372. Console.WriteLine(Central_Alignment & "################")
  373.  
  374. ' Date
  375. Console.WriteLine(Right_Alignment & "Date: " & Today)
  376. Console.Write(Right_Alignment & "================")
  377. Console.WriteLine()
  378. Console.WriteLine(Central_Text_Alignment & "Your Current Balance is: £" & Balance & ".")
  379. Console.WriteLine()
  380. Console.WriteLine(Central_Text_Alignment & "Press enter to return to the main menu.")
  381. Console.ReadLine()
  382. GoTo Menu
  383. Help:
  384. ' Help Screen
  385. Console.Clear()
  386. Console.WriteLine()
  387. Console.WriteLine(Central_Alignment & "################")
  388. Console.WriteLine(Central_Alignment & " Help ")
  389. Console.WriteLine(Central_Alignment & "################")
  390.  
  391. ' Date
  392. Console.WriteLine(Right_Alignment & "Date: " & Today)
  393. Console.Write(Right_Alignment & "================")
  394.  
  395. Console.WriteLine()
  396. Console.WriteLine(Central_Text_Alignment & "Check Account Details")
  397. Console.WriteLine(Central_Text_Alignment & "===========================")
  398. Console.WriteLine(Central_Text_Alignment & "If you want to check account details, select option 1 on the menu screen.")
  399. Console.WriteLine()
  400. Console.WriteLine()
  401. Console.WriteLine(Central_Text_Alignment & "Make Withdrawal")
  402. Console.WriteLine(Central_Text_Alignment & "==============")
  403. Console.WriteLine(Central_Text_Alignment & "If you want to make a withdrawal, select option 2 on the menu screen.")
  404. Console.WriteLine()
  405. Console.WriteLine()
  406. Console.WriteLine(Central_Text_Alignment & "Make Deposit")
  407. Console.WriteLine(Central_Text_Alignment & "============")
  408. Console.WriteLine(Central_Text_Alignment & "If you want to make a deposit, select option 3 on the menu screen.")
  409. Console.WriteLine()
  410. Console.WriteLine()
  411. Console.WriteLine(Central_Text_Alignment & "Apply for Overdraft")
  412. Console.WriteLine(Central_Text_Alignment & "===================")
  413. Console.WriteLine(Central_Text_Alignment & "If you want to apply for overdraft, select option 4 on the menu screen.")
  414. Console.WriteLine()
  415. Console.WriteLine()
  416. Console.WriteLine(Central_Text_Alignment & "Check Previous Transactions")
  417. Console.WriteLine(Central_Text_Alignment & "===========================")
  418. Console.WriteLine(Central_Text_Alignment & "If you want to check previous transactions, select option 5 on the menu screen.")
  419. Console.WriteLine()
  420. Console.WriteLine()
  421. Console.WriteLine(Central_Text_Alignment & "Check Balance")
  422. Console.WriteLine(Central_Text_Alignment & "=============")
  423. Console.WriteLine(Central_Text_Alignment & "If you want to check you balance, select option 6 on the menu screen.")
  424. Console.WriteLine()
  425. Console.WriteLine()
  426. Console.WriteLine(Central_Text_Alignment & "Exiting System")
  427. Console.WriteLine(Central_Text_Alignment & "==============")
  428. Console.WriteLine(Central_Text_Alignment & "If you want to exit the system, select option 8 on the menu screen.")
  429. Console.WriteLine()
  430. Console.WriteLine()
  431.  
  432. Console.ReadLine()
  433. GoTo Menu
  434.  
  435. Exit_System:
  436. ' Application Exit Menu
  437. Console.Clear()
  438. Console.WriteLine()
  439. Console.WriteLine(Central_Alignment & "################")
  440. Console.WriteLine(Central_Alignment & " Exit ")
  441. Console.WriteLine(Central_Alignment & "################")
  442.  
  443. ' Date
  444. Console.WriteLine(Right_Alignment & "Date: " & Today)
  445. Console.WriteLine(Right_Alignment & "================")
  446.  
  447. Console.WriteLine(Central_Alignment & "Are you sure you want to exit?")
  448. Console.WriteLine()
  449. Console.WriteLine(Central_Alignment & "1. No")
  450. Console.WriteLine()
  451. Console.WriteLine(Central_Alignment & "2. Yes")
  452. Console.WriteLine()
  453. User_Input = Console.ReadLine
  454.  
  455. ' Select Case Statement that Displays Menu Items
  456. Select Case User_Input
  457. Case 1
  458. GoTo Menu
  459. Case 2
  460. End
  461. End Select
  462.  
  463. Console.ReadLine()
  464. Change_PIN:
  465. Num_Of_Attempts = 3
  466.  
  467. ' Change PIN Screen
  468. Console.Clear()
  469. Console.WriteLine()
  470. Console.WriteLine(Central_Alignment & "################")
  471. Console.WriteLine(Central_Alignment & " Change PIN ")
  472. Console.WriteLine(Central_Alignment & "################")
  473.  
  474. ' Date
  475. Console.WriteLine(Right_Alignment & "Date: " & Today)
  476. Console.Write(Right_Alignment & "================")
  477.  
  478. Console.WriteLine()
  479. Console.Write(Central_Alignment & "Please enter new PIN: ")
  480. User_Input = Console.ReadLine
  481.  
  482. ' IF Statement Seeing IF User_Input is Not Equal to PIN and IF the length of User_Input is Equal the length of "1234"
  483. If User_Input <> PIN And User_Input.Length = "1234".Length Then
  484. PIN = User_Input
  485. MsgBox("Your PIN has successfuly changed. You will now be returned to the menu.")
  486. GoTo Menu
  487. End If
  488.  
  489. ' Do Until Loop Seeing whether IF User_Input is Not Equal to PIN
  490. Do Until User_Input <> PIN
  491. If User_Input = PIN Then
  492. Num_Of_Attempts -= 1
  493. MsgBox("Your new PIN cannot be the same as your current PIN. Please try again. Attempts remaining: " & Num_Of_Attempts)
  494. If Num_Of_Attempts = 0 Then
  495. MsgBox("Too many Attempts. Please try again later.")
  496. GoTo Account_Details
  497. End If
  498. GoTo Change_PIN
  499. End If
  500. Loop
  501.  
  502. ' Do Until Loop with Nested IF Statements
  503. Do Until User_Input.Length = "1234".Length
  504. If User_Input.Length <> "1234".Length Then
  505. Num_Of_Attempts -= 1
  506. MsgBox("Your new PIN is either too long or too short, please try again. Attempts remaining: " & Num_Of_Attempts)
  507. If Num_Of_Attempts = 0 Then
  508. MsgBox("Too many Attempts. Please try again later.")
  509. GoTo Account_Details
  510. End If
  511. GoTo Change_PIN
  512. End If
  513. Loop
  514.  
  515. Console.ReadLine()
  516.  
  517. Overdraft:
  518. ' Overdraft Screen
  519. Console.Clear()
  520. Console.WriteLine()
  521. Console.WriteLine(Central_Alignment & "################")
  522. Console.WriteLine(Central_Alignment & " Overdraft ")
  523. Console.WriteLine(Central_Alignment & "################")
  524.  
  525. ' Date
  526. Console.WriteLine(Right_Alignment & "Date: " & Today)
  527. Console.Write(Right_Alignment & "================")
  528. Console.WriteLine()
  529. Console.Write(Central_Text_Alignment & "Please enter the amount you wish to overdraft: £")
  530. User_Input = Console.ReadLine()
  531. Console.WriteLine()
  532. Console.Write(Central_Text_Alignment & "Please pay £" & User_Input * 1.5 & " back in 30 days.")
  533. Console.WriteLine()
  534. Console.Write(Central_Text_Alignment & "Press enter to return to the main menu.")
  535. Console.ReadLine()
  536.  
  537. LoadFile: ' Procedure to load the file into memory
  538. File_Name = "account.txt"
  539. File_Num = FreeFile() ' Set File_Number with Freefile function
  540. Count = 0 ' Initialise to start at zero
  541. If File_Name <> "" Then
  542. Try
  543. FileOpen(File_Num, File_Name, OpenMode.Input) ' Open file for reading
  544. Do Until EOF(File_Num)
  545. Count = Count + 1 ' Increment Count for Array
  546. Account_Details(Count, 0) = LineInput(File_Num) ' Date
  547. Account_Details(Count, 1) = LineInput(File_Num) ' Transaction
  548. Account_Details(Count, 2) = LineInput(File_Num) ' MoneyIn
  549. Account_Details(Count, 3) = LineInput(File_Num) ' MoneyOut
  550. Account_Details(Count, 4) = LineInput(File_Num) ' Balance
  551. Balance = Account_Details(Count, 4) ' Balance
  552. Loop
  553. Last_Record = Count ' Store number of last record in the array
  554. Catch
  555. MsgBox("Error Opening File")
  556. Finally
  557. FileClose(File_Num)
  558. End Try
  559. End If
  560. Last_Record = Count
  561. 'MsgBox("File Loaded", , Last_Record & " FILES UPDATED")
  562. GoTo Menu ' Display MainMenu
  563. End Sub
  564.  
  565. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement