Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Bank Account : Given the below BankAccount.java file, provide an accompanying Ba

ID: 3631315 • Letter: B

Question

Bank Account :

Given the below BankAccount.java file, provide an accompanying BankAccountDriver.java file that “exercises” (tests) the BankAccount class by calling its methods. Specifically, your BankAccountDriver class should:

• Declare and instantiate a BankAccount object.
• Prompt the user for a customer name.
• Call setCustomer, passing in the user-entered customer name.
• Prompt the user for a bank account number.
• Call setAccountNum, passing in the user-entered bank account number.
• Call printAccountInfo.

Don’t forget to use proper style in your BankAccountDriver.java file (including a prologue section at the top of the file).

Write your code so that it works in conjunction with the below class. When run, your program should produce the output shown in the subsequent sample session.

/***************************************
* BankAccount.java
* Dean & Dean
*
* This program stores and prints information
* for a bank account.
***************************************/

public class BankAccount
{
private String customer; // customer's name
private int accountNum; // bank account number

//**************************************************

public void setCustomer(String customer)
{
this.customer = customer;
} // end setCustomer

public void setAccountNum(int accountNum)
{
this.accountNum = accountNum;
} // end setAccountNum

//**************************************************

// This method prints a bank account's information.

public void printAccountInfo()
{
System.out.println(
this.customer + "'s account number is " +
this.accountNum + ".");
} // end printAccountInfo
} // end class BankAccount

Sample session:

Customer name: William Gates
Account number: 123456
William Gates's account number is 123456.

Explanation / Answer

please rate - thanks

import java.util.*;
public class BankAccountDriver {

public static void main(String[] args)
{String name;
int num;
BankAccount b= new BankAccount();
Scanner in=new Scanner(System.in);
System.out.print("Customer name: ");
name=in.nextLine();
b.setCustomer(name);
System.out.print("Account number: ");
num=in.nextInt();
b.setAccountNum(num);
b.printAccountInfo();

}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote