Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  1. 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.

    1. getBalance: takes no input and returns a double that is the current balance in the account.

    2. getInterestRate: takes no input and returns a double that is the interest rate.

    3. setInterestRate: takes a double as input and returns nothing. Changes the interest rate.

    4. transfer: takes a double as input and returns nothing. Reduces the current balance by the input amount.

    5. getInterestEarned: takes no input and returns a double that is the amount of interest accrued this month.

    6. 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.

    7. processMonth: takes no input and returns nothing. Adds the current monthly interest to the balance and sets the current monthly interest to zero.

    The Cash class should have a single constructor that takes one double (the interest rate) as input.

  2. 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:

    1. deposit: takes a double as input and returns nothing. Increases the balance by the input amount.

    2. 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.

    The Savings class should have a single constructor that sets the interest rate.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the meaning and definition of E-Business?

Answered: 1 week ago