0% found this document useful (0 votes)
11 views

BankingSystem_JavaScript

The document contains JavaScript functions for creating an account and depositing money in a banking system. The 'createAccount' function checks for valid input before attempting to create an account, while the 'depositMoney' function validates the account number and deposit amount before processing the transaction. Both functions include console logging for actions and alert messages for invalid input.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

BankingSystem_JavaScript

The document contains JavaScript functions for creating an account and depositing money in a banking system. The 'createAccount' function checks for valid input before attempting to create an account, while the 'depositMoney' function validates the account number and deposit amount before processing the transaction. Both functions include console logging for actions and alert messages for invalid input.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

// Assume manager object is part of your backend system and connected

function createAccount() {

var accountNumber = document.getElementById('accountNumber').value;

var accountHolder = document.getElementById('accountHolder').value;

if (accountNumber && accountHolder) {

console.log("Creating account for " + accountHolder + " with Account Number: " +
accountNumber);

// Call backend function (e.g., manager.createAccount(accountNumber, accountHolder))

} else {

alert("Please fill all fields.");

function depositMoney() {

var accountNumber = document.getElementById('depositAccount').value;

var amount = parseFloat(document.getElementById('amount').value);

if (accountNumber && amount > 0) {

console.log("Depositing " + amount + " to Account Number: " + accountNumber);

// Call backend function (e.g., manager.depositToAccount(accountNumber, amount))

} else {

alert("Please provide valid input.");

You might also like