Question: (java) C: Class Inheritance [10 marks] Consider the following 00 class: public claas q9t pubilic int q; public aq( int q) this.q =4; , The
C: Class Inheritance [10 marks] Consider the following 00 class: public claas q9t pubilic int q; public aq( int q) this.q =4; , The intention is that objects of this class have some state (the attribute q) that onee sict ceannet be chamgent. Finst rowrite this class so that (a) the value of q can never be changed, and (i.) it nase information hiding. Add any appropriate getters/setters. Next, writen a new chass wh that extends the class Q9. The new class should (c) introduce a new attribute (a. String labctede x ) and have a constructor that takes an integer (for q ) and String (for w) as inptit and sets the state of the object approriately
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
