Question
JAVA 1. A bank offers two types of account for its customers, a savings account and a checking account. The savings account provides compound interest
JAVA
1. A bank offers two types of account for its customers, a savings account and a checking account. The savings account provides compound interest* and transfers money between accounts. The checking account provides withdrawal but no interest. Checking account holders should also maintain a minimum balance of $300 while a savings account should have a minimum balance of $100. If the balance falls below the minimum requirement, a service charge is imposed.
Create a class Account that stores customer name, account number and type of account. From this derive two classes CheckingAccount and SavingsAccount. Include appropriate methods/instance variables to achieve the following tasks:
(a).Deposit amount to an account (checking or savings)
(b).Display the balance of an account (checking or savings)
(c).Compute and deposit compound interest of a savings account
(d).Permit withdrawal and update the balance accordingly (checking or savings). Check that the withdrawal should not be more than the account balance available. Impose a service charge, if the balance falls below the minimum balance required. Also, give user an option to transfer funds from the savings account (if sufficient balance available) when withdrawing from a checking account if there are insufficient funds available in the checking account. Update the savings balance accordingly.
*Compound Interest is calculated as:
CI = P (1 + r/n) (nt)
Where:
CI = Compound Interest
P = the principal investment amount (the initial deposit) r = the annual interest rate (decimal)
n = the number of times that interest is compounded per year t = the number of years the money is invested or borrowed for
Ref: https://www.thecalculatorsite.com/articles/finance/compound-interest-formula.php
You may get input from user for each function. When your program starts, create a checking account object and a savings account object, and displays a menu of four functions that a user can select.
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