Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java You are given two classes, BankAccount and ManageAccounts ManageAccounts is called a Driver class that uses BankAccount. associate a member to BankAcount that shows

Java
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
You are given two classes, BankAccount and ManageAccounts ManageAccounts is called a Driver class that uses BankAccount. associate a member to BankAcount that shows the Date and Time that Accounts is created. You may use a class Date. To find API on class Date, search for Date.java. Make sure to include date information to the method toString) you must follow the instruction and Upload two java files. BankAccount.java and ManageAccounts.java. A Bank Account Class . File Account.java contains a partial definition for a class representing a bank account. Save it to your directory and study it to see what methods it contains. Then complete the Account class as described below. Note that you won't be able to test your methods until you write ManageAccounts in question #2. Fill in the code for method toString, which should return a string containing the name, account number, and balance for the account. Fill in the code for method chargeFee, which should deduct a service fee from the account. Modify chargeFee so that instead of returning void, it returns th make changes in two places. Fill in the code for method changeName which takes a string as a parameter and changes the name on the account to be that string. e new balance. Note that you will have to File ManageAccounts java con tains a shell program that uses the Account class above. Save it to your directory and complete it as indicated by the comments. . Modify ManageAccounts so that it prints the balance after the calls to chargeFees. Instead of using the getBalance method like you did after the deposit and withdrawal, use the balance that is returned from the chargeFees method. You can either store it in a variable and then print the value of the variable, or embed the method call in a println statement. // Account.java // A bank account class with methods to deposit to, withdraw from, // change the name on, charge a fee to, and print a summary of the account. // Account.java // A bank account class with methods to deposit to, withdraw from, // change the name on, charge a fee to, and print a summary 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; name owner: 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) balance - = amount; else System.out.println ("Insufficient funds"); // Adds deposit amount to balance public void deposit (double amount) balance += amount; // Returns balance public double getBalance () return balance; // Returns a string containing the name, account number, and balance. public String toString () // Deducts $10 service Itee /I public void chargeFee () // Changes the name on the account public void changeName (String newName) // ManageAccounts.java Use Account class to create and manage Sally and Joe' s bank accounts public class ManageAccounts

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

How We Listen?

Answered: 1 week ago