Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The management of the Yes Bank is looking at automation as a means to save time and effort required to carry out the various banking

The management of the Yes Bank is looking at automation as a means to save time and effort required to carry out the various banking transactions. In order to achieve this, the management has planned to computerize the following transactions:

  • Creating a new account
  • Withdrawing money from an account
  • Depositing money in an account

The CEO of the company has hired a team of experts to provide a solution for the same. Consider yourself to be a part of the team that implements the solution for designing the application.

Create an application using exceptions to implement the transactions. The application should consist of the following classes.

Account.java

  • java
  • java

Each class has a specific purpose and functionality. The descriptions of each class are as follows:

Account.java

The Account class represents an actual bank account. It stores the following details of a bank account such as customerName, accountNumber, and balance. The instance variables are initialized in the constructor of the class. The Account class will be used by the Bank class to create bank accounts.

Bank.java

The Bank class stores the bank details of the customers account such as bankId, bankName, and branch. The instance variables are initialized in the constructor of the class. The Bank class implements the following methods:

  • void displayAccountDetails(Account): This method displays the bank and account details of the account object passed as an argument to the method.

  • void createAccount(String username, double balance): This method accepts the user name and the opening balance from the user to create a new instance of the Account class.

  • void withdraw(String accountNumber, double amount): This method is used to withdraw money from an account. The method consists of a try- catch block to throw an exception if the withdrawal amount is greater than the balance.

  • void deposit(String accountNumber, double amount): This method is used to deposit money in an account. The account number and the amount to be deposited in the account are accepted from the user.

BankTest.java

The BankTest class is the main Java class used to test the Bank class. It creates an instance of the Bank class and accepts the bank and account details from the user. The required method is invoked on the instance of the Bank class based on the users selected transaction. The class consists of a try-catch block to check for the format of balance or amount passed by the user to raise the NumberFormatException if the amount is specified as a string. Also, the try- catch block checks for the IllegalArgumentException if the argument supplied to the method is incorrect and the ArrayIndexOutOfBoundsException if the numbers of arguments exceed the required limit.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

7-5 How will MIS help my career?

Answered: 1 week ago