NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>MYP215- Internet Programcılığı 1</title>
</head>
<body onLoad="atmMachineUsername();">
<script>
var username,
correct_pass = (/^[0-9]{4}$/),
passTry = 3,
currentBalance = 35000;


function atmMachineUsername() {
username = prompt("Enter your name");
if (username !== "" && username !== null) {
atmMachinePassword();
} else {
atmMachineUsername();
}
}

function atmMachinePassword() {
var pswEntry = parseInt(prompt("Dear " + username + ", enter your 4 digit PIN"));
checkPassword(pswEntry);
}

function checkPassword(userInput) {
if (correct_pass.test(userInput)){
selectAccountType();
} else {
while (!(correct_pass.test(userInput))) {
if (passTry === 1) {
alert("Incorrect PIN.");
alert("Maximum tries exceeded! Your account has been locked. Contact your bank for support.");
exit();
break;
} else {
passTry -= 1;
alert("Incorrect PIN. Please try again.");
alert("You have " + passTry + " chance/s to try");
atmMachinePassword();
}
}
}
}

function selectAccountType() {
var accountType = parseInt(prompt("Which type of account do you have? n 1. Savings n 2. Current n 3. Credit"));
if (accountType !== "" && accountType !== null && !isNaN(accountType)) {
selectFunction();
} else {
alert("Please make a valid selection");
selectAccountType();
}
}
function selectFunction() {
var atmFunctions = parseInt(prompt("Hello " + username + ", what can we do for you today? n 1. Inquiry n 2. Withdrawal n 3. Deposit n 4. Exit"));
if (atmFunctions !== "" && atmFunctions !== null && !isNaN(atmFunctions)) {
switch (atmFunctions) {
case 1:
inquiry();
break;
case 2:
withdrawal();
break;
case 3:
deposit();
break;
case 4:
exit();
break;
default:
alert("Please make a valid selection");
selectFunction();
}
} else {
alert("Please make a valid selection");
selectFunction();
}
}
function inquiry() {
alert("Your current balance is $" + currentBalance);
toContinue();
}
function deposit() {
var depositAmount = parseInt(prompt("How much do you want to deposit?"));
if (depositAmount !== "" && depositAmount !== null && !isNaN(depositAmount)) {
currentBalance += depositAmount;
alert("You have successfully deposited $" + depositAmount + "n" + "You now have $" + currentBalance);
toContinue();
} else {
alert("Error: please enter a number!");
deposit();
}
}
function withdrawal() {
var withdrawalAmount = parseInt(prompt("How much do you want to withdraw? n" + "The minimum amount you can withdraw is $1000"));
if (withdrawalAmount !== "" && withdrawalAmount !== null && !isNaN(withdrawalAmount)) {
if (withdrawalAmount >= 1000) {
if (withdrawalAmount <= currentBalance) {
currentBalance -= withdrawalAmount;
alert("Transaction successful!");
alert("Your remaining balance is $" + currentBalance);
toContinue();
} else {
alert("You do not have sufficient funds!");
withdrawal();
}
} else {
alert("You must withdraw at least $1000");
withdrawal();
}
} else {
alert("Error: please enter a number!");
withdrawal();
}
}

function toContinue(){
var yesOrNo = parseInt(prompt("Do you want to perform another transaction? n 1. Yes n 2. No"));
if (yesOrNo !== "" && yesOrNo !== null) {
if (yesOrNo === 2){
exit();
}
else {
selectAccountType();
}
} else {
alert("Please make a valid selection");
toContinue();
}
}
function exit() {
alert("Thank you for patronising our ATM machine");

}
</script>
</body>
</html>
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.