Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This Program is in Java. Design a class named Account that contains: Aprivate int data field named id (whose default value is 0) *Aprivate double
This Program is in Java.
Design a class named Account that contains: Aprivate int data field named id (whose default value is 0) *Aprivate double data field named balance (whose default value is 1000) *Aprivate double data field named annuallnterestRate (whose default value 2. is 4.50). *A no-arg constructor that creates a new Account object with default values. *A second constructor that creates an Account with a specified id and non-negative initial balance (and the default interest rate). A third constructor that creates an Account with a specified id, non-negative initial balance, and non-negative interest rate. *public accessor and mutator methods for all three instance variables. A public method named getMonthlyInterestRate interest rate (annualInterestRate/12) that returns the monthly A public method named withdraw() that takes a double argument. If the account balance is smaller than that amount, print a statement saying that there are insufficient funds and leave the balance unchanged. Otherwise, deduct the argument value from the current account balance. A public deposit () method that adds the value of its (positive) double argument to the current account balance. *A public toString() method that prints the values of each instance variable in an appropriate format. Next, create a subclass of Account named CheckingAccount. A CheckingAccount has an overdraft limit (a double instance variable whose value is set by an additional constructor and a mutator method); if you attempt to withdraw more oney than the account currently has, the withdrawal still succeeds as long as the total amount is less than or equal to the current balance plus the overdraft limit (the account balance just becomes negative after this). Override tostring() to include the overdraft limit. Write a test program that creates one Account and one CheckingAccount and invokes their toString) methods
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started