We have already coded the class User. It includes the instance variables name, age, and email, an overloaded constructor, and the toString method coded as follows:
public String toString( )
{
// return some String representation of this User object
}
We are now coding the class SuperUser, which inherits from User. SuperUser has one instance variable, fee, which is a double. We want the toString method of the SuperUser class to return the same String as the toString method of the User class, plus a semicolon, a space, and the value of fee.
Example 1: If the toString method of User returns Mike, 23, HYPERLINK "mailto:mike@msn.com" mike@msn.com, and the value of fee is 19.9, the toString method of SuperUser returns Mike, 23, HYPERLINK "mailto:mike@msn.com" mike@msn.com, 19.9.
Example 2: If the toString method of User returns Jane, 22, HYPERLINK "mailto:jane@gmail.com" jane@gmail.com, and the value of fee is 24.9, the toString method of SuperUser returns Jane, 22, HYPERLINK "mailto:jane@gmail.com" jane@gmail.com, 24.9.
Code the toString method of the SuperUser class here. Assume that we do not know what the toString method of User returns.
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q79: The ArrayList method indexOf has the following
Q80: Class Reply inherits from class Post. Write
Q81: Class Rectangle inherits from class Shape and
Q82: Here is interface I.
public interface I
{
public abstract
Q83: I is an interface, A is an
Q85: What is the output of the following
Q86: We have coded class ABC and it
Q87: We have coded the following sequence:
try
{
Scanner scan
Q88: The file data.txt contains ABC before the
Q89: The file numbers.txt contains only positive integers.
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