Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the difference between Figure 9.9 and Figure 9.11 (both are implementation of BasePlusCommissionEmployee class) This is Figure 9.9 This is Figure 9.11 Class BasePluscommissionEnployee

Write the difference between Figure 9.9 and Figure 9.11 (both are implementation of BasePlusCommissionEmployee class)
This is Figure 9.9 image text in transcribed
image text in transcribed
This is Figure 9.11
image text in transcribed
image text in transcribed
Class BasePluscommissionEnployee Class BasePluscomnissionEnployee (Fig. 9.9) extends the new version of class commis- sionEnployee with protected instance variables. BasePluscommissionEnployee objects inherit CommissionEmployee's protected instance variables firstNane, lastName, so cialSecurityNumber, grossSales and commissionRate-all these variables are now pro- tected members of BasePlusconmissionEmployee. As a result, the compiler does not generate errors when compiling line 45 of method earnings and lines 54-56 of method tostring. If another class extends this version of class BasePluscommissionEmployee, the new subclass also can access the protected members. I Fig. 9.9: BasePluscommissionEmployee.java 2 Base Plus CommissionEmployee inherits protected instance 3 variables from CommissionEmployee. 5 public class BasePlusCommissionEmployee extends CommissionEmployee 7 private double basesalary base salary per week Fig. 9.9 l BasePluscommissionEmployee inherits protected instance variables from Commission Employee. (Part I of 2) 380 Chapter 9 Object-Oriented Programming: inheritance 11 six-a rgument constructor 10 public Base PlusC firstName, String lastName ommissionEmployee(String String social Securit r, double gros sSales double commissionRate, double baseSalary) super(firstName, lastNane, socialSecurityNumber. 14 gross Sales commission Rate) 15 16 if basesalary is invalid throw exception if (baseSalary 0.0) throw new niegalArgumentExceptionC "Base salary must be 0.0"); this basesalary base salary 25 set base salary public void setBasesalaryCdouble basesalary) if (base salary 0.0) throw new niega ArgumentException( "Base salary must be 0-0"); this basesalary base salary return base salary public double getBasesalaryO base salary return

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions

Question

What is the use of a tagline?

Answered: 1 week ago

Question

Find y'. y= |x + X (x) (x) X 1 02x+ 2x 1 O 2x + 1/3 Ex 2x +

Answered: 1 week ago