Question: a) Write the constructor definition for both subclasses (4 marks) Subclass : SwimmingGlass Attributes: private char Type; // 'A' Anti-fogging goggle, 'S' - short-sighted goggle


a) Write the constructor definition for both subclasses (4 marks) Subclass : SwimmingGlass Attributes: private char Type; // 'A' Anti-fogging goggle, 'S' - short-sighted goggle private String style; // "Retro", "Warrior" or "Modern" Method: /ecessary constructor, getter and setter methods public double calCharges() //method to calculate the price public String toString() // method to display the data members Subclass : Cycling Glass Attributes: private char type_glass / T' Transition Glass, 'p' Polarized glass, I' Iridium glass */ private boolean uvProtection; /* with UV protection extra RM 30 will be charge to the total price */ Method: /ecessary constructor, getter and setter methods public double calcharges() //method to calculate charges=price-deposit public String toString() 7/ method to display the data members
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
