Assume the class Student implements the Speaker interface from the textbook. Recall that this interface includes two abstract methods, speak( ) and announce(String str). A Student contains one instance data, String classRank. Write the Student class so that it implements Speaker as follows. The speak method will output "I am a newbie here" if the Student is a "Freshman", "I hate school" if the Student is either a "Sophomore" or a "Junior", or "I can not wait to graduate" if the student is a "Senior". The announce method will output "I am a Student, here is what I have to say" followed by the String parameter on a separate line. Finally, the classRank is initialized in the constructor. Only implement the constructor and the methods to implement the Speaker interface.
Correct Answer:
Verified
...
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q42: Why is it a contradiction for an
Q43: A motorcycle inherits properties from both a
Q49: Explain the difference between implementing an interface
Q58: An applet implements MouseListener, and has int
Q59: If A, B, Y and Z all
Q60: If a class extends Applet and also
Q61: What instance data and methods might you
Q66: In what manners are Timer objects similar
Q67: What is the advantage of extending an
Q68: What methods inherited from Car should SportsCar
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents