Question: Corret the java code, public class BankAccount { private String account _ number; private double balance; private String last _ transaction _ type; private double

Corret the java code, public class BankAccount {
private String account_number;
private double balance;
private String last_transaction_type;
private double last_transaction_amount;
private static int accounts count =0;
private static double total_balances =10000000;
public BankAccount(String account_number, double balance){
this . account_number = account_number;
this.balance = balance;
this.last_transaction_type ="";
this.last_transaction_amount =0;
accounts_count++;
total_balances += balance;
public BankAccount (BankAccount other)
this.account_number = other.account_number;
this.balance = other.balance;
this.last_transaction_type ="";
this.last_transaction_amount =0;
accounts_count++;
total_balances += balance;
public void deposit(double amount){
balance += amount;
last_transaction_type = "Deposit";
last_transaction_amount = amount;
total_balances += amount;
System.out.println("Account 1:");
System.out.println("Account number: "+ obj1.get_account_number());
System.out.println("Account balance; "+ obj1.get_balance());
lic static double get_total_balances()
return total_balances;
public class TestBankAccount {
public static void main(String[] args){
BankAccount obj1= new BankAccount("0000",3000);
BankAccount obj2= new BankAccount ("11111",10000);
BankAccount obj3= new BankAccount(obj1);
obj1.withdraw(6000);
obj2.withdraw(5000);
Write a TestBankAccount class with a main() method. In the main method do the following: ? Create 2 objects of BankAccount Class: 3000 AED for the first, 10000 AED for the second. Suggest your own values for account_number. ?] Create another object that is a copy of the first object. ?? Withdraw 6000 AED from the first account, and 5000 AED from the second account. ? Print the account number, the balance and the last transaction of all account objects. ?? Print the number of accounts in the bank and the total balances
The amount is not available Account 1:
Account number: 0000
Account balance: 3000.0
Last transaction: 0.0
Account 2:
Account number: 11111
Account balance: 5000.0
Last transaction: 5000.0
Account 3:
Account number: 0000
Account balance: 3000.0
Last transaction: 0.0
Number of accounts: 3
Total balances: 1.0011E7
BUILD SUCCESSFUL (total time: 0 seconds)
How to remove "The amount is not available" appear
Should be
2 or 3
accounts?
 Corret the java code, public class BankAccount { private String account_number;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!