arthurdapaz

Bank Machine Test

Jun 16th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.58 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3.    <head>
  4.       <title>oh</title>
  5.       <h2>Bank Machine</h2>
  6.       <img src="https://www.riobk.com/ContentImageHandler.ashx?ImageId=76121"alt="Welcome to our bank">
  7.    </head>
  8.    <body>
  9.       <script type="text/javascript">
  10.         //variable
  11.         var accountname = 5;
  12.         var accountpass = 6;
  13.         var count = 3;
  14.         //array
  15.         var matrix = [
  16.         ["Mr", "John", "Smith", 46, 10000, "smith_j", "welcome"],
  17.         ["Ms", "N", "Painchaud", 21, 60000, "MsP", "hurtyou"],
  18.         ["Mrs", "Julie", "Donner", 45, 500, "dontlknow", 1234],
  19.         ["Mrs", "T", "Wit", 34, 350, "twit", "nuunuu"]];
  20.  
  21.         //
  22.         // FUNCTION DECLARATIONS
  23.         //
  24.         function login() {
  25.             for (var row = 0; row < matrix.length;row++)
  26.             {
  27.                 if ((username == matrix[row][5]) && (password == matrix[row][6]))
  28.                 {
  29.                     alert("Welcome! " + matrix[0][5] + ".");
  30.                 }
  31.             }
  32.             alert("incorrect!");
  33.             count--;
  34.         }
  35.  
  36.         function disaster() {
  37.             do {
  38.                 var disaster = prompt("Do you want to check your withdrawal (1)? deposit (2) or balance (3)");
  39.                 switch(disaster)
  40.                 {
  41.                     case"1":
  42.                     withdrawal();
  43.                     again=2;
  44.                     break;
  45.                     case"2":
  46.                     deposit();
  47.                     again=2;
  48.                     break;
  49.                     case"3":
  50.                     balance();
  51.                     again=2;
  52.                     break;
  53.                     default: var again=1;
  54.                 }
  55.             } while(again=1);
  56.         }
  57.  
  58.  
  59.         function withdrawal() {
  60.             var money = prompt("How much?");
  61.             money = parseInt(money)
  62.            
  63.             if (matrix[accountname][accountpass]-money<0)
  64.                 alert("You don't have enough funds!")
  65.  
  66.             var w = prompt("try again? yes or no?");
  67.            
  68.             if (w == "yes") withdrawal();
  69.             else {
  70.                 matrix[accountname][accountpass]=money;
  71.                 alert("Your new balance is "+matrix[accountname][accountpass]);
  72.             }
  73.         }
  74.         function deposit() {
  75.             var amount = prompt("How much?");
  76.             benefit = parseInt(benefit);
  77.         }
  78.  
  79.         function antransaction() {
  80.             uantransction = prompt("Do you want another transaction?");
  81.             return uantransction;
  82.         }
  83.         function balance() {
  84.             do {
  85.                 alert("Your current balance is $" + balance + ".");
  86.             } while (antransaction())
  87.         }
  88.  
  89.         function nontransaction() {
  90.             var printout = prompt("Do you want a printout of your transaction?")
  91.             if (printout == "yes")
  92.                 alert("Thank you!!")
  93.             else
  94.                 document.write("Your balance is $" + hahabalance + ".")
  95.         }
  96.  
  97.  
  98.         //
  99.         // RUN THE SCRIPT AT PAGE LOAD
  100.         //
  101.  
  102.         while (count > 0) {
  103.             //entering user name and password
  104.             var username = prompt("Give me a username, welcome");
  105.             var password = prompt("type your password, please! you only have three chances!!!!!!!!!!!!!!");
  106.             login();
  107.         }
  108.        
  109.       </script>
  110.    </body>
  111. </html>
Add Comment
Please, Sign In to add comment