Answer to Question #279313 in Java | JSP | JSF for syahidah

Question #279313

Given the following classes and inheritance hierarchy which are used to store various types of

communication services provided by TMPOINT previously known as Telekom Malaysia :


and the following definition for the TMPoint class :

public class TMPoint

{ String phoneNo;

String custName;

String dateinstall;

double installFee;

//constructor

//accessor methods


}

Streamyx class is inherited from class TMPoint. Its new attribute is package type and usage time.

Telephone class is also inherited from class TMPoint. Its new attribute is minuteUsed.

a) Define the constructor for superclass TMPoint and its subclass Streamyx and Telephone.

(8 marks)

b) Write the accessor and setter methods for each attribute from the superclass and subclasses.

(4 marks)


1
Expert's answer
2021-12-13T16:57:29-0500


package tmpoint;




public class TMPoint {


String phoneNo;


String custName;


String dateinstall;


double installFee;
TMPoint(){
    
}
public TMPoint(String p, String c, String d, double i){
    phoneNo = p;
    custName = c;
    dateinstall = d;
    installFee = i;
}


void setinstallFee(double i){
     installFee = i;
}
void setphoneNo(String i){
     phoneNo = i;
}
void setDateinstall(String i){
     dateinstall = i;
}
void setCustName (String i){
     custName = i;
}


String getPhone(){
         return phoneNo;
     }
String getCustName(){
         return custName;
     }
String getDateinstall(){
         return dateinstall;
     }
double getinstallFee(){
         return installFee;
     }
    public static void main(String[] args) {
        // TODO code application logic here
    }
    
}


class Streamyx extends TMPoint{
    
     private String type, usage_time;
     Streamyx(String t, String u){
         type = t;
         usage_time = u;
     }
     void setType(String t ){
         type = t;
     }
     
     String getType(){
         return type;
     }
     void setUsageTime(String t ){
         usage_time = t;
     }
     
     String getUsageTime(){
         return usage_time;
     }
    
}


class Telephone  extends TMPoint{
    
     private String minuteUsed;
     Telephone(String t){
         minuteUsed = t;
        
     }
     
     void setMinuteUsed(String t ){
         minuteUsed = t;
     }
     
     String getMinuteUsed(){
         return minuteUsed;
     }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog