Assume the existence of a Phone class with a constructor that accepts two parame
ID: 3909098 • Letter: A
Question
Assume the existence of a Phone class with a constructor that accepts two parameters: a string for the phone number followed by a boolean representing whether the phone provides added-value services. Assume a subclass MP3Phone has been defined that has two instance variables: an integer, memorySize, for the size, in megabytes of the phone memory, and a boolean, playsAAC, representing whether the phone is capable of playing AAC-encoded audio files. Write a constructor for MP3Phone that accepts three parameters: a String for the phone number (which is passed up to the Phone constructor, together with the value true for the added-value boolean), and an integer followed by a boolean for the instance variables.
Explanation / Answer
public MP3Phone(String phoneNumber, int mSize, boolean aAC) {
super(phoneNumber, true);//calling super class constructor
//setting remaining values for instance variables
this.mSize = mSize;
AAC = aAC;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.