Question: Transform the procedural style computation of the previous problem into an objectoriented application. In order to do this, create two classes named BankCD and BankingObjectStyle

Transform the procedural style computation of the previous problem into an objectoriented application. In order to do this, create two classes named BankCD and BankingObjectStyle as specified below.

a.The class named BankCD describes each CD offering and should have

The instance (or member) variables bankName (String), initialDeposit (integer), rate (double) and numberOfYears (integer).

A single constructor that takes the name of the bank.

The appropriate set methods for the above variables except the bank name.

The appropriate get methods for all of the instance variables.

The method getFinalValue, of type double, which returns the final value of this CD.

The method printCDDetails, of type void, which displays the details of this CD to the console. This method should invoke the getFinalValue method as part of its output.

b.The class named BankingObjectStyle creates two CD objects and tests them as follows:

In the main method, instantiate two objects of the type BankCD named bank1CD and bank2CD.

Perform the equivalent steps to the ones carried out in Part 1 by setting the appropriate values for the objects. Print the details of the two objects. Invoke the getFinalValue method for comparing the two. The output should be the same as in Part 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!