Question
In Java The Cash class. The Cash class represents an account that deals in money. The Cash class will have a balance, an interest rate,
In Java
-
The Cash class. The Cash class represents an account that deals in money. The Cash class will have a balance, an interest rate, and a record of the amount of interest earned. The class should have the following methods.
-
getBalance: takes no input and returns a double that is the current balance in the account.
-
getInterestRate: takes no input and returns a double that is the interest rate.
-
setInterestRate: takes a double as input and returns nothing. Changes the interest rate.
-
transfer: takes a double as input and returns nothing. Reduces the current balance by the input amount.
-
getInterestEarned: takes no input and returns a double that is the amount of interest accrued this month.
-
processDay: takes no input and returns nothing. If the account balance is positive, multiplies the balance by the interest rate (divided by 365) and adds the amount to the current monthly interest.
-
processMonth: takes no input and returns nothing. Adds the current monthly interest to the balance and sets the current monthly interest to zero.
-
-
The Savings class. The Savings class is a Cash class that represents money deposited or earned by the customer. The Savings class has the same properties and behaviors of the Cash class plus the following two additional methods:
-
deposit: takes a double as input and returns nothing. Increases the balance by the input amount.
-
withdraw: takes a double as input and returns a boolean. If the input amount is less than or equal to the current balance, reduces the balance by the input amount and returns true. Otherwise returns false and makes no change to the balance.
-
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