Question: Introduction to Java Programming Please include some comments in your source code. As well as implementing the subclasses, provide a test main method in the
Introduction to Java Programming
Please include some comments in your source code. As well as implementing the subclasses, provide a test main method in the main class SubclassesTest that demonstrates the use of your classes and methods.
Have all your classes inside one .java file, SubclassesTest.java. Do not have a separate file for each of your classes.
11.3 (Subclasses of Account) In Programming Exercise 9.7, the Account class was defined to model a bank account. An account has the properties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds. Create two subclasses for checking and saving accounts. A checking account has an overdraft limit, but a savings account cannot be overdrawn. Draw the UML diagram for the classes and then implement them. Write a test program that creates objects of Account, SavingsAccount, and CheckingAccount and invokes their toString() methods.
Exercise 9.7 (The Account class) Design a class named Account that contains: A private int data field named id for the account (default 0 ). A private double data field named balance for the account (default 0 ). A private double data field named annualInterestRate that stores the cur- rent interest rate (default 0 ). Assume all accounts have the same interest rate. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default account. A constructor that creates an account with the specified id and initial balance. The accessor and mutator methods for id , balance , and annualInterestRate . The accessor method for dateCreated . A method named getMonthlyInterestRate() that returns the monthly interest rate. A method named getMonthlyInterest() that returns the monthly interest. A method named withdraw that withdraws a specified amount from the account. A method named deposit that deposits a specified amount to the account.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
