.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

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter10: Classes And Objects
Section: Chapter Questions
Problem 5RQ: Which of the following statements is false? a. A class can contain only one constructor. b. An...
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.


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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning