Question: Java Project goals: This project assignment will provide some experience with multiple inheritance. You will be required to create Java source files. Be sure to

Java Project goals: This project assignment will provide some experience with multiple inheritance. You will be required to create Java source files. Be sure to submit the source codes together with the execution of them.

Function Requirements: You are to create the following classes with the specified methods. These classes are created with the specified Person super class. After creation you should test these classes with the main program. The methods required for this assignment are as follows:

Methods for class Employee: set/getSalary toString

Methods for class Stockholder: set/get baseSalary set/get NumberOfShares set/getDividendsPerShare ComputeDividends toString

Methods for class Executive: basePlusDividendSalary toString The Executive class is publically derived from Stockholder. The Employee and Stockholder classes use a Person class. Then modify the Executive class as necessary.

The methods for the classes listed above can be implemented in the class or inherited from some super classes. If input values are invalid, throw exception such as an IllregalArgumentException. For example, if (grossSales < 0.0) throw new IllegalArgumentException(Gross Sales should be greater than 0.0.); this.grossSales = grossSales;

Sample Test Code // assign superclass reference to superclass variable

Stockholder sObj = new Stockholder("David NewMan", "4607 Westerdale Dr", 80000, 50,10);

//assign subclass reference to subclass variable Executive exObj = new Executive("John Smith","444 William Ave",130000,100, 10);

// invoke toString on superclass objet using superclass variable System.out.printf(.., sObj.toString());

//invoke toString on subclass object using subclass variable System.out.printf( .., exObj.toString());

//invoke toString on subclass object using superclass variable Stockholder sObj2 = exObj; System.out.printf(.., sObj2.toString());

Sample Output run:

Polymorphism Test:

Assigning superclass and subclass reference to superclass and subclass variables.

Call Stockhoder's toString with superclass variable to superclass object

Name: David NewMan

Address: 4607 Westerdale Dr

Base Salary: $80,000.00

Number of Shares: 50

Dividend per Share: $10.0

Total Dividend: $500.00

Call Executive's toString with subclass variable to subclass object

Name: John Smith

Address: 444 William Ave

Base Salary: $130,000.00

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!