Question: Java Please use the exact skeleton program. A Flexible Account Class File Account java contains a definition for a simple bank account class with methods
Java



Please use the exact skeleton program.
A Flexible Account Class File Account java contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a String representation. Note that the constructor for this class creates a random account number. Save this class to your directory and study it to see how it works. Then modify it as follows 1. Overload the constructor as follows .public Account (double initBal, String owner, long number) initializes the balance, owner, and account number as specified public Account (double initBal, String owner) - initializes the balance and owner as specified; randomly generates the account number public Account (String owner) - initializes the owner as specified; sets the initial balance to 0 and randomly generates the account number 2. Overload the withdraw method with one that also takes a fee and deducts that fee from the account File TestAccount,java contains a simple program that exercises these methods. Save it to your directory, study it to see what it does, and use it to test your modified Account class. // Account.java / A bank account class with methods to deposit to, withdraw from, // change the name on, and get a String representation / of the account. public class Account private double balance; private String name; private long acctNum; //Constructor -- initializes balance, owner, and account number public Account (double initBal, String owner, long number) balance - initBal; nameOwner; acctNum = number / Checks to see if balance is sufficient for withdrawal. / If so, decrements balance by amount; if not, prints message public void withdraw (double amount) if (balance amount) balanceamount; else System.out.println("Insufficient funds") // Adds deposit amount to balance
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
