QuestionQuestion

There are many different kinds of investments, including stocks, mutual funds, real estate, and bank accounts. There are two kinds of bank accounts: checking and savings.

Design an abstract Investment class that includes a name attribute, a value attribute (double), and a getter method, getValue(). The Investment class, being abstract, cannot be instantiated. Design subclasses: Stocks, MutualFunds, RealEstate, and BankAccount.

• The attributes of Stocks are name, pricePerShare, numberOfSharesOwned, and dividend (a percent of the investment paid annually).
• The attributes of MutualFunds are: name, pricePerShare, and numberOfSharesOwned.
• The attributes of RealEstate are: name, addressOf Property, purchasePrice, and    currentAssessedValue.   
• BankAccount is an abstract class that extends   Investment. The name field holds the bank’s name. An additional attribute accountNumber (String) represents an account number.
•   BankAccount has two subclasses: SavingsAccount and CheckingAccount.
• A SavingsAccount object has an annual interest rate paid quarterly. SavingsAccount has a method addInterest() that adjusts the balance of the account.
• A CheckingAccount is-a BankAccount with a minimum balance, a penalty if the balance goes below the minimum in any month, and an annual interest rate (paid monthly) on the money in excess of the minimum balance. Include method addInterest(),   which adds one month’s interest to the balance, and a method checkBalance(),   which adjusts the balance if the balance falls below the minimum.      

The classes are simple. Each class has a default constructor that sets each instance variable to the empty string or zero, whichever is appropriate, and a second constructor that sets the class attributes, including value. Each class that is not   abstract   should also include a method displayData() that prints all the information of a particular investment, properly labeled.

A portfolio is an array of Investment references. Implement a Portfolio class that also includes a getNetValue() method. This method returns the sum of the values of all investments referenced by portfolio. Interactively, create a portfolio   with at least six investments, including stocks, mutual funds, real estate, and a bank account. Display the data for each investment along with the net value of all investments.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

public class CheckingAccount extends BankAccount {

    private double rate; // paid monthly on the money in excess of the minimum balance
    private double minimum;
    private double penalty; // a penalty if the balance goes below the minimum in any month

    public CheckingAccount() {
       name = "";
       value = 0;
       accountNumber = "";
       rate = 0;
       minimum = 1000;
       penalty = 1;
    }

    public CheckingAccount(String name, double balance,
            String accountNumber, double rate) {
       this.name = name;
       this.accountNumber = accountNumber;
       this.rate = rate;
       value = balance;
       minimum = 1000;   
       penalty = 1;
    }
      
    /**
    * adds one month’s interest to the balance
    * and an annual interest rate (paid monthly)
    * on the money in excess of the minimum balance
    */
    public void addInterest() {
       if (value > minimum) {
            value += (value - minimum)* rate / 12;
       }      
    }

    /**
    * adjusts the balance if the balance falls below the minimum
    */
    public void checkBalance() {
       if (value < minimum) {
            value -= penalty;
       }
    }...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

50% discount

Hours
Minutes
Seconds
$50.00 $25.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats