Given the BankAccount.java file below, provide an accompanying BankAccountDriver
ID: 3623895 • Letter: G
Question
Given the BankAccount.java file below, provide an accompanying BankAccountDriver.java filethat “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 attached class. When run, your program
should produce the output shown in the subsequent sample session.
Sample session:
Customer name: William Gates
Account number: 123456
William Gates's account number is 123456.
[code]
/***************************************
* 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
[/code]
Explanation / Answer
nevermind
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.