Question: Hi , I need help with this task in Java: Inheritance Homework Assignment Requirements Create a new Java Package with our Package Naming conventions .
Hi I need help with this task in Java:
Inheritance Homework
Assignment Requirements
Create a new Java Package with our Package Namingconventions
Choosedescriptivevariable names and identifiers in all programs.
Use the Java style for braces.
Add a few more comments in each program to explain what your code is doing.
When all programs are done, you'll need to export your package: exportInstructions
Upload the zip to this drop box. I will add your packages to my project and run them.
Type yourcollaboration statementinto the message area of the drop box.
Submit your assignment to the dropbox.
For this assignment, you are to implement the following class diagram. This assignment will feature constructor overloading, local and inherited constructor chaining, overriding methods, and calling superclass methods from subclasses.
Account
There is only one constructor, which takes two arguments: the balance and the account number of the Account.
The withdraw method should only withdraw funds if the requested amount is less than or equal to the balance. For now, the code should silently fail if the customer requests more than the balance
The deposit method adds the amount passed in to the balance
The addInterest method calculates the interest and adds it to the balance.Assume the interest is as shown in the diagram
The getBalance is a simple getter method. It returns the balance.
CheckingAccount
There are two overloaded constructors. Assume the starting balance is zero if the one argument constructor is called.
The withdraw method is overridden. For checking accounts, customers get three free checks, after which they are charged a flat rate of $ for each check withdraw after this limit This method should call the superclass method withdraw and include any fees as part of the withdrawal.
SavingsAccount
There are two overloaded constructors. Assume the starting balance is zero if the one argument constructor is called.
The addInterest method is overridden. Savings accounts only accrue interest if there is a minimum balance. If that criteria is met, apply the interest by using the super class method addInterest Assume the minimum balance is as shown in the diagram.
Notes:
The arg constructor in both subclasses must call their arg constructor to initialize the object.local constructor chaining
The arg constructors in both subclasses must call the superclass constructor in order to properly initiate the account superclass constructor chaining
Testing:
To test your code, create a separate class that will create an instance of a Checking and Savings account. You probably want to create two instances of each, since there are two constructors. Once you have your instances, call the methods to deposit and withdraw money and verify that the balance is correct, per the requirements. Also, you should verify that the addInterest method produces correct results as well. For example, you could write code similar to below for testing basic withdrawals.note : you should verify that all methods work correctly
CheckingAccount checking new CheckingAccount;
checking.withdraw;
checking.withdraw;
System.out.printlncheckinggetBalance; should be
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
