Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAM InvestmentsPractice with Inheritance from Chapter 12 Exersice Program #3, form book Java Programming from the Ground Up. There are many different kinds of

JAVA PROGRAM InvestmentsPractice with Inheritance from Chapter 12 Exersice Program #3, form book Java Programming from the Ground Up.

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 banks 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 months 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions