
The following subclasses named RegularService and PremiumService are inherited from a superclass named Customer.
Superclass : Customer Atributes : String name; // customer name String address; // customer address String telno; // customer mobile phone number int noOfSms; // number of SMS that has been sent double minutesCall; // total minutes of calls boolean threeG; // 3G features or not
Subclass : RegularService Atributes : int numVoiceSms; // number of voice SMS that has been sent
Subclass : PremiumService Atributes : double minutesVideoCall; // total minutes of video calls double minutesVideoMail; // total minutes of video mails
Scenarios : The services provided by the telecommunication company can be divided into three types of services which are Basic, Regular and Premium services. The details are shown in the table below
SERVICES FEATURES RATE Basic SMS 5 cents each Call 20 cents per minute Regular Voice SMS 50 cents each Premium Video Call RM1.00 per minute Video Mail 80 cents per minute a) Write the normal constructor methods for superclass and subclasses. b) Write the accessor and mutator methods for superclass and subclasses. c) Write the processor methods which calculate the total charges for subclasses. i) Given the processor method for subclass of RegularService named getTotalRegular() to return the total charges of SMS, calls and voice SMS. ii) Given the processor method for subclass of PremiumService named getTotalPremium() to return the total charges of SMS, calls, video call and video mail. d) Write the main program to input the data and display the charges.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.