.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. Write your code so that it works in conjunction with the below class. When run, your program should produce the output shown in the subsequen
In Java
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.
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
* 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.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images