Question: can you please solve JS OOP OPTION 1.- Banking App In this exercise you will build a simple banking system according the design shown in
can you please solve JS OOP


OPTION 1.- Banking App In this exercise you will build a simple banking system according the design shown in Figure 1. Bank BankAccount accounts : BankAccount accountio : number getAccount/accountNo: number): BankAccount balance number deleteAccount(accountNo: number) deposit(amount number) avgBalance(): number withdrawiamount number) sumBalance number to String serialize() string deserialize(accounts Json String) BankAccount avingAccount Current Account monthlyFee: number minBalance : number distributeBenefit beneftpercentage number) toString() deductFee) toString) Figure 1. Banking System Class Diagram 1) Create Bank Account class with the following properties: accountNo, balance. This class should have a constructor to initialize these 2 properties. This class should have these methods: - deposit(amount): this method adds the amount to the balance withdraw(amount); this method subtracts the amount from the balance - toStringl): this method return Account # accountNo has QR balance. e.g., Account #123 has QR1000 Export the BankAccount class module as an object. 2) Create app.js program. Declare accounts variable array and initialize it with the following accounts: accountNo 123 1000 234 345 3500 Display the content of the accounts array. 3) Create SavingAccount class that extends BankAccount with an extra property: minBalance and an extra method distributeBenefit(benefit Percentage). This method computes the monthly benefit using the balance += (balance * benefit Percentage). The constructor should balance 4000 extend BankAccount to initialize the minBalance. Also, extend the toStringl) to indicate that this is a Saving Account. e.g., e.g., Saving Account #123 has QR1000. Test savingAccount in app.js using the same table above and use a minimum balance of 500 for all accounts. 4) Create Current Account class that extends BankAccount with an extra property: monthlyfee and an extra method deductFeel). This method subtracts the monthlyfee from the account balance only if the deducted fee is less than the balance. The constructor should extend BankAccount to initialize the monthlyfee. Also, extend the toString) to indicate that this is a Current Account. e.g, e.g., Current Account #123 has QR1000. Test currentAccount in app.js using the same table above and use a monthly fee of 15 for all accounts 5) Create Bank class to manage accounts. It should have a property accounts to store the accounts. Also, it should have the following methods: Method Functionality add(account) Add account (either Saving or Current) to accounts array. getAccount accountNo) Return an account by ld deleteAccount(accountNo) Delete an account by ld avgBalancel) Get the average balance for all accounts sumBalancel) Get the sum balance for all accounts serialize() Return accounts as a JSON string deserialize(accounts son Takes JSON string representing accounts and returns an array of accounts. 6) Create app.js program. Declare an instance of Bank class then add the following accounts: accountNo balance type minimumBalance monthlyFee 123 500 Saving 1000 234 4000 Current 15 345 35000 Current 25 456 60000 Saving 1000 1. Test all the bank methods described above. II. Display the total balance of all accounts. III. Go through all the Current accounts and charge the monthly fee Display the total balance of all accounts after charging the monthly fee. V. Go through all the Saving accounts and distribute the benefit using a 5% benefit. VI. Display the total balance of all accounts after distributing the benefits. IV. OPTION 1.- Banking App In this exercise you will build a simple banking system according the design shown in Figure 1. Bank BankAccount accounts : BankAccount accountio : number getAccount/accountNo: number): BankAccount balance number deleteAccount(accountNo: number) deposit(amount number) avgBalance(): number withdrawiamount number) sumBalance number to String serialize() string deserialize(accounts Json String) BankAccount avingAccount Current Account monthlyFee: number minBalance : number distributeBenefit beneftpercentage number) toString() deductFee) toString) Figure 1. Banking System Class Diagram 1) Create Bank Account class with the following properties: accountNo, balance. This class should have a constructor to initialize these 2 properties. This class should have these methods: - deposit(amount): this method adds the amount to the balance withdraw(amount); this method subtracts the amount from the balance - toStringl): this method return Account # accountNo has QR balance. e.g., Account #123 has QR1000 Export the BankAccount class module as an object. 2) Create app.js program. Declare accounts variable array and initialize it with the following accounts: accountNo 123 1000 234 345 3500 Display the content of the accounts array. 3) Create SavingAccount class that extends BankAccount with an extra property: minBalance and an extra method distributeBenefit(benefit Percentage). This method computes the monthly benefit using the balance += (balance * benefit Percentage). The constructor should balance 4000 extend BankAccount to initialize the minBalance. Also, extend the toStringl) to indicate that this is a Saving Account. e.g., e.g., Saving Account #123 has QR1000. Test savingAccount in app.js using the same table above and use a minimum balance of 500 for all accounts. 4) Create Current Account class that extends BankAccount with an extra property: monthlyfee and an extra method deductFeel). This method subtracts the monthlyfee from the account balance only if the deducted fee is less than the balance. The constructor should extend BankAccount to initialize the monthlyfee. Also, extend the toString) to indicate that this is a Current Account. e.g, e.g., Current Account #123 has QR1000. Test currentAccount in app.js using the same table above and use a monthly fee of 15 for all accounts 5) Create Bank class to manage accounts. It should have a property accounts to store the accounts. Also, it should have the following methods: Method Functionality add(account) Add account (either Saving or Current) to accounts array. getAccount accountNo) Return an account by ld deleteAccount(accountNo) Delete an account by ld avgBalancel) Get the average balance for all accounts sumBalancel) Get the sum balance for all accounts serialize() Return accounts as a JSON string deserialize(accounts son Takes JSON string representing accounts and returns an array of accounts. 6) Create app.js program. Declare an instance of Bank class then add the following accounts: accountNo balance type minimumBalance monthlyFee 123 500 Saving 1000 234 4000 Current 15 345 35000 Current 25 456 60000 Saving 1000 1. Test all the bank methods described above. II. Display the total balance of all accounts. III. Go through all the Current accounts and charge the monthly fee Display the total balance of all accounts after charging the monthly fee. V. Go through all the Saving accounts and distribute the benefit using a 5% benefit. VI. Display the total balance of all accounts after distributing the benefits. IV
Step by Step Solution
There are 3 Steps involved in it
To build the simple banking system according to the design described implement the classes and methods in JavaScript as follows Step 1 BankAccount Cla... View full answer
Get step-by-step solutions from verified subject matter experts
