Home > Back-end >  New to Java, would like to know how to do this problem
New to Java, would like to know how to do this problem

Time:10-09

Programming:
Create a class the first generation of mobile phones and request contains information (tel_id), phone number and include access to phone Numbers (getTel_id (), returns the value of tel_id), storage number (setTel_id (), modified tel_id value), make a phone call (CallTel (), output: you dial the telephone number of the... Is switched on), and hung up the phone (endCall (), output: end of the phone), and other functions, and such as the parent class, subclass class of the second generation mobile phones and add photos (setImage (), output: photo) function, with the second generation of mobile objects to generate and mock implementation call, hang up the phone and take pictures, and other functions,

CodePudding user response:

I were at the score, this subject belongs to the foundation, remember after receiving knock code, the main content is to let you understand the relationship between father and son class, privatisation and object-oriented data and methods into the open, and remember "ah, I but for scores, ha ha
 
Public class FirstPhone {
Private Integer tel_id;

Public Integer getTel_id () {
Return tel_id;
}

Public void setTel_id (Integer tel_id) {
Enclosing tel_id=tel_id;
}

Public void callTel () {
System. Out.println (" you dial the telephone number of the... Are switched on in ");
}

Public void endCall () {
System. The out. Println (" over ");
}
}

 
Public class SecondPhone extends FirstPhone {

Public static void main (String [] args) {
SecondPhone sp=new SecondPhone ();
Sp. CallTel ();
Sp. EndCall ();
Sp. SetImage ();
}

Public void setImage () {
System. The out. Println (" photos ");
}
}
  • Related