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. Do not forget to use proper style in your BankAccountDriver.java file (including comments and 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 * 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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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.
Do not forget to use proper style in your BankAccountDriver.java file (including
comments and 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
* 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.

Expert Solution
Algorithm
  1. Import the java.util.Scanner library.
  2. Create a class BankAccountDriver with a main method.
  3. Inside the main method, create a Scanner object input to read input from the user.
  4. Create a BankAccount object account.
  5. Prompt the user for a customer name and store it in a String variable customer.
  6. Call the setCustomer method on account and pass in customer.
  7. Prompt the user for a bank account number and store it in an int variable accountNum.
  8. Call the setAccountNum method on account and pass in accountNum.
  9. Call the printAccountInfo method on account to display the customer name and account number.
  10. End the main method.
  11. End the BankAccountDriver class.
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY