In: Computer Science
JAVA PROGRAM: Creates a Bank Account class with one checking account and methods to withdraw and deposit. Test the methods in the main function.
//Hope this answer helps you
// In case u feel any doubt feel free to ask in comments
// I will be happy to solve them
// code in java to implement a BankAccount class
//Hope u like it
import java.util.*;
import java.util.Scanner;
class BankAccount
{
    public double bal;
    public String accountNumber; 
    public BankAccount(String accountNumber, double initialBalance)//Constructor
    {
        bal = initialBalance;
        accountNumber = accountNumber;
    }
    //Withdraw function
    public void withdraw(double amount)
    {
        double newBal = bal - amount;
        bal = newBal;           
    }
    //Deposit function with depositing balance to existing balance
    public void deposit(double amount)
    {
        double newBal = bal + amount;
        bal = newBal;                   
    }
    // function used to display the details of Account
    public void displayDetails()
    {
        System.out.println("Account Number is: "+accountNumber+" and Balance is: "+bal);
    }
    public static void main(String[] args)
    {
        // making two accounts object of BankAccount class
        BankAccount secondAccount = new BankAccount("3598896", 200000);
        BankAccount firstAccount = new BankAccount("3598895", 100000);
        // calling appropriate functions to test the above functions
        System.out.println("Initial Balance is:");
        firstAccount.displayDetails();
        secondAccount.displayDetails();
        firstAccount.deposit(30000);
        secondAccount.withdraw(10000);
        System.out.println("After operations Balance is:");
        firstAccount.displayDetails();
        secondAccount.displayDetails();
    }
}
SCREENSHOTS: