Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

In-Class Exrercise-2: (10 Marks) Using Composition Rather Than Inheritance: Many programs written with inheritance could be written with composition instead, and vice versa. Rewrite class...

1 answer below »
In-Class Exrercise-2: (10 Marks)
Using Composition Rather Than Inheritance:
Many programs written with inheritance could be written with composition instead, and vice
versa.
Rewrite class BasePlusCommissionEmployee (Fig. 9.11) [Referencing to Module-2, Ch-9] of the
CommissionEmployee–BasePlusCommissionEmployee hierarchy to use composition rather
than inheritance.
Deliverable:
1. Report (3 Marks)
2. Source code (7 marks)
Sample output:
Answered Same Day Oct 03, 2021

Solution

Amar Kumar answered on Oct 04 2021
145 Votes
public class CommissionEmployee3
{
private String firstName;
private String lastName;
private String socialSecurityNumber;
private double grossSales;
private double commissionRate;
public CommissionEmployee3( String first, String last,
String ssn, double sales, double sate )
{
firstName = first;
lastName = last;
socialSecurityNumber = ssn;
setGrossSales( sales );
setCommissionRate( rate );
}
public void setFirstName( String first )
{
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here